【问题标题】:how to let a minimized form to notify user to open it from taskbar?如何让最小化的表单通知用户从任务栏打开它?
【发布时间】:2018-03-15 02:35:56
【问题描述】:

我正在开发一个客户端和服务器之间的小型聊天应用程序。

我希望在收到消息并且聊天窗口最小化时收到通知(例如在实时信使中)

这是我将收到的消息附加到的方法。

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?
    }
}

对不起,我的英语不好。我希望我为这些问题写了正确的词。

【问题讨论】:

    标签: c# winforms notifications


    【解决方案1】:
    [DllImport("user32.dll")]
    private static extern bool FlashWindowEx(ref FLASHWINFO pwfi);
    

    使用 user32 方法使窗口闪烁。 您可以阅读有关该方法及其参数here 的更多信息。 它有完整的代码和使用示例。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-22
      • 1970-01-01
      • 2014-11-19
      • 2020-07-26
      • 2020-11-10
      • 1970-01-01
      相关资源
      最近更新 更多