Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to make my WinApp flash in statusbar?

Status
Not open for further replies.

chenshch

Technical User
Jun 9, 2004
8
CN
hello,
how to make my winApp stay in statusbar and make it flash
if necessery. Do i have use a win32 API for example:
flashwindowEx. if so how to use it?
waiting for help
 
Yes, you have to use Win32 API. Here is an working example.

public class Form1 : System.Windows.Forms.Form
{

[StructLayout(LayoutKind.Sequential)]
internal struct FlashInfo
{
internal int cbSize;
internal IntPtr hWnd;
internal Int32 dwFlags;
internal Int32 uCount;
internal Int32 dwTimeout;
}
[DllImport("user32.dll")]
private static extern bool FlashWindowEx(IntPtr pwfi);

private const int FLASHW_STOP = 0;
private const int FLASHW_CAPTION = 0x00000001;
private const int FLASHW_TRAY = 0x00000002;
private const int FLASHW_ALL = (FLASHW_CAPTION | FLASHW_TRAY);
private const int FLASHW_TIMER = 0x00000004;
private const int FLASHW_TIMERNOFG = 0x0000000C;


private void CalcBtn_Click(object sender, System.EventArgs e)
{
FlashInfo wfi = new FlashInfo();
wfi.cbSize = Marshal.SizeOf(wfi.GetType());
wfi.dwFlags =FLASHW_ALL;
wfi.dwTimeout = 100;
wfi.hWnd = this.Handle;
wfi.uCount = 100;
IntPtr ptr = Marshal.AllocCoTaskMem(wfi.cbSize);
Marshal.StructureToPtr(wfi, ptr, true);
FlashWindowEx(ptr);
//...
//Marshal.FreeCoTaskMem(ptr);

}

//..
}
-obislavu-



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top