如何让一个最小化的形式通知用户从任务栏打开它? [英] how to let a minimized form to notify user to open it from taskbar?

查看:112
本文介绍了如何让一个最小化的形式通知用户从任务栏打开它?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

IM开发客户端和服务器。结果
I之间的一个小聊天应用程序想,当收到消息和聊天窗口最小化(如在现场messeger)



下面是我追加收到消息的方法到。

 公共无效AppendChat(string信息)
{
如果(InvokeRequired)
{
this.Invoke(新动作<串GT;(AppendChat),新的对象[] {味精});
的回报;
}
txtChat.AppendText(GETTIME()+味精+ Environment.NewLine + Environment.NewLine);
如果(this.WindowState == FormWindowState.Minimized)
{
// ...我应该这里写的是什么?
}
}



对不起我的英文不好..我希望我写的对于这些问题的话语权。


解决方案

 函数[DllImport(user32.dll中) ] 
私人静态外部布尔FlashWindowEx(REF FLASHWINFO pwfi);

使用的方法USER32闪烁的窗口。
你可以阅读更多有关方法,它是parametrs的此处
它有如何使用它的一个完整的代码和示例。


im 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 messeger)

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. You can read more about the method and it's parametrs here. It has a complete code and examples for how to use it.

这篇关于如何让一个最小化的形式通知用户从任务栏打开它?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆