471,337 Members | 1,438 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Using C Sharp to make application flash at bottom of screen?

At the bottom of a windows screen are those rectangular boxes for each
application. Sometimes they flash to alert the user that somethign has
happened. How can I make my own C Sharp applications flash?
Aug 19 '08 #1
3 1697
use the following code in your form class .... or change it as needed.

-J-

private void FlashIt()
{
FLASHWINFO fi = new FLASHWINFO();
fi.cbSize = (uint)System.Runtime.InteropServices.Marshal.SizeO f(fi);
fi.hwnd = Handle;
fi.dwFlags = FLASHW_TRAY;
fi.uCount = 3;
fi.dwTimeout = 0;
FlashWindowEx(ref fi);
}

[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool FlashWindowEx(ref FLASHWINFO pwfi);

[StructLayout(LayoutKind.Sequential)]
public struct FLASHWINFO
{
public UInt32 cbSize;
public IntPtr hwnd;
public UInt32 dwFlags;
public UInt32 uCount;
public UInt32 dwTimeout;
}

//Stop flashing. The system restores the window to its original state.
public const UInt32 FLASHW_STOP = 0;
//Flash the window caption.
public const UInt32 FLASHW_CAPTION = 1;
//Flash the taskbar button.
public const UInt32 FLASHW_TRAY = 2;
//Flash both the window caption and taskbar button.
//This is equivalent to setting the FLASHW_CAPTION | FLASHW_TRAY flags.
public const UInt32 FLASHW_ALL = 3;
//Flash continuously, until the FLASHW_STOP flag is set.
public const UInt32 FLASHW_TIMER = 4;
//Flash continuously until the window comes to the foreground.
public const UInt32 FLASHW_TIMERNOFG = 12;
Aug 19 '08 #2
Import the windows user32 dll function:

[DllImport("user32.dll")]
static extern bool FlashWindow(IntPtr hwnd, bool bInvert);
then in a method put:
FlashWindow(this.Handle, true);
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"Bernard.Mangay" wrote:
At the bottom of a windows screen are those rectangular boxes for each
application. Sometimes they flash to alert the user that somethign has
happened. How can I make my own C Sharp applications flash?
Aug 19 '08 #3
thanks guys!
Aug 19 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Phi | last post: by
2 posts views Thread by Owen | last post: by
11 posts views Thread by Grischa Brockhaus | last post: by
1 post views Thread by newToAjax | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.