zoobird
asked on
Flashing application in the taskbar
How do I flash the application title in the taskbar?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hooray! it works! thanks.
i do need to know when the user has clicked on the flashing button so i can stop it from flashing. how do i do this?
i do need to know when the user has clicked on the flashing button so i can stop it from flashing. how do i do this?
whom are you asking to?
when the application will get the focus it will no more blink!!
when the application will get the focus it will no more blink!!
ASKER
Desp, it still blinks.
//START Blinking
private void button1_Click(object sender, System.EventArgs e)
{
FLASHWINFO f = new FLASHWINFO();
f.hwnd=this.Handle;
f.dwTimeout=0;
f.dwFlags = FLASHW_ALL;
f.cbSize = Marshal.SizeOf( f);
f.uCount=100;
FlashWindowEx( ref f);
}
//STOP Blinking
private void button2_Click(object sender, System.EventArgs e)
{
FLASHWINFO f = new FLASHWINFO();
f.hwnd=this.Handle;
f.dwTimeout=0;
f.dwFlags = FLASHW_STOP;
f.cbSize = Marshal.SizeOf( f);
f.uCount=100;
FlashWindowEx( ref f);
}
private void button1_Click(object sender, System.EventArgs e)
{
FLASHWINFO f = new FLASHWINFO();
f.hwnd=this.Handle;
f.dwTimeout=0;
f.dwFlags = FLASHW_ALL;
f.cbSize = Marshal.SizeOf( f);
f.uCount=100;
FlashWindowEx( ref f);
}
//STOP Blinking
private void button2_Click(object sender, System.EventArgs e)
{
FLASHWINFO f = new FLASHWINFO();
f.hwnd=this.Handle;
f.dwTimeout=0;
f.dwFlags = FLASHW_STOP;
f.cbSize = Marshal.SizeOf( f);
f.uCount=100;
FlashWindowEx( ref f);
}
ASKER
Thanks for your help Desp I really appreciate it and will definitely award you with the points. Is there any way to stop the blinking when the user clicks on the flashing button at the taskbar?
yeah , put the stop flashing code in the Form_Activated event ;-)
anymore questions?
ASKER
is there any way to know whether the button is already blinking or if FlashWindowEx is active?
gee, thanks.
ASKER
Aaron, I will reward you the same number of points. I will post a question with title,"Points for AaronReams". Thanks for your help too.
ASKER
Aaron, would you know how to detect whether the button is blinking?
Hi zoobird,
Thanx. I'm not sure of the best way to detect if the button is blinking. It just depends on how you are using it. There's a few different options...
You could maintain state on your own with a bool in your class.
You can always just call FlashWindow(this.Handle, false) to disable the flashing and return to its original state (active or inactive).
You can also check the state of FlashWindow using the return type.
<MSDN>
The return value specifies the window's state before the call to the FlashWindow function. If the window caption was drawn as active before the call, the return value is nonzero. Otherwise, the return value is zero.
Good luck.
-Aaron
Thanx. I'm not sure of the best way to detect if the button is blinking. It just depends on how you are using it. There's a few different options...
You could maintain state on your own with a bool in your class.
You can always just call FlashWindow(this.Handle, false) to disable the flashing and return to its original state (active or inactive).
You can also check the state of FlashWindow using the return type.
<MSDN>
The return value specifies the window's state before the call to the FlashWindow function. If the window caption was drawn as active before the call, the return value is nonzero. Otherwise, the return value is zero.
Good luck.
-Aaron
using System.Runtime.InteropServ
// Add this to your class
[DllImport("user32.dll", CharSet=CharSet.Auto)]
public static extern int FlashWindow(int hwnd, int bInvert);
// Call this from within your class to flash the window once
FlashWindow((Int32)this.Ha