Murhaf Sousli
Murhaf Sousli

Reputation: 13306

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)

enter image description here

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.

Upvotes: 0

Views: 1157

Answers (1)

YoryeNathan
YoryeNathan

Reputation: 14532

[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.

Upvotes: 3

Related Questions