I have a TCP Chat application. When a new message arrives, I want to make the taskbar glow until the user opens the form again (in case it wasn't focus/activated).
An example of what I mean: http://puu.sh/4z01n.png
How can I make it glow like that?
Thanks!
If you still don't understand what I mean.. The image I provided is what appears ON the icon i nthe taskbar when something "glows". Meaning there is a notifcation. That's what I want to acheive.
I hope this will help you
[DllImport("User32.dll")]
[return:MarshalAs(UnmanagedType.Bool)]
static extern bool FlashWindowEx(ref FLASHINFO pwfi);
[StructLayout(LayoutKind.Sequential)]
public struct FLASHWINFO {
public UInt32 cbSize;
public IntPtr hwnd;
public UInt32 dwFlags;
public UInt32 uCount;
public UInt32 dwTimeout;
}
[Flags]
public enum FlashMode {
///
/// Stop flashing. The system restores the window to its original state.
///
FLASHW_STOP = 0,
///
/// Flash the window caption.
///
FLASHW_CAPTION = 1,
///
/// Flash the taskbar button.
///
FLASHW_TRAY = 2,
///
/// Flash both the window caption and taskbar button.
/// This is equivalent to setting the FLASHW_CAPTION | FLASHW_TRAY flags.
///
FLASHW_ALL = 3,
///
/// Flash continuously, until the FLASHW_STOP flag is set.
///
FLASHW_TIMER = 4,
///
/// Flash continuously until the window comes to the foreground.
///
FLASHW_TIMERNOFG = 12
}
public static bool FlashWindow(IntPtr hWnd, FlashMode fm) {
FLASHWINFO fInfo = new FLASHWINFO();
fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
fInfo.hwnd = hWnd;
fInfo.dwFlags = (UInt32)fm;
fInfo.uCount = UInt32.MaxValue;
fInfo.dwTimeout = 0;
return FlashWindowEx(ref fInfo);
}
Taken from my wiki at Flashing Taskbar
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With