简体   繁体   English

如何让最小化表单通知用户从任务栏打开它?

[英]how to let a minimized form to notify user to open it from taskbar?

I'm developing a small chat application between client and server. 我正在开发客户端和服务器之间的小型聊天应用程序。

I would like to get notified when a message received and the chat window is minimized (like in live messenger) 我希望在收到消息并且聊天窗口最小化时得到通知(例如在实时Messenger中)

在此处输入图片说明

here's the method that I append the received message onto. 这是我将接收到的消息附加到的方法。

public void AppendChat(string msg)
{
    if (InvokeRequired)
    {
        this.Invoke(new Action<string>(AppendChat), new object[] { msg });
        return;
    }
    txtChat.AppendText(GetTime() + msg + Environment.NewLine + Environment.NewLine);
    if (this.WindowState == FormWindowState.Minimized)
    {
        //... what should I write in here?
    }
}

sorry for my bad English. 对不起,我的英语不好。 I hope I wrote the right words for the questions. 我希望我为这些问题写了正确的词。

[DllImport("user32.dll")]
private static extern bool FlashWindowEx(ref FLASHWINFO pwfi);

Use the user32 method to flash the window. 使用user32方法刷新窗口。 You can read more about the method and it's parametrs here . 您可以在此处阅读有关该方法及其参数的更多信息。 It has a complete code and examples for how to use it. 它具有完整的代码和使用示例。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM