You need some interoperability to achieve this,first of all add System.Runtime.InteropServices
namespace to your class,the in you class define this function at the beginning,
[DllImport("user32.dll")]
static extern bool FlashWindow(IntPtr hwnd, bool FlashStatus);
It is an API function and it's description says, The FlashWindow function flashes the specified window once..Then add a Timer
to your class(drag-drop it from the toolbox,set its interval to 500 Milliseconds).Then assuming Form1
is the window you want to flash,use the following code to achieve this;
private void Form1_Activated(object sender, EventArgs e)
{
timer1.Stop();//Stop the timer to stop flashing.
}
private void Form1_Deactivate(object sender, EventArgs e)
{
timer1.Start();//Start timer if window loses focus.
}
private void timer1_Tick(object sender, EventArgs e)
{
FlashWindow(this.Handle, true);//Flash the window untill it gets focused.
}
Well,call timer1.Start();
when a new message arrives.A sample just in case if you need.
Hope this helps you.