Make form's title bar & taskbar Blink

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
useing aim as an example (we all know what aim is) when your chatting with people on aim and you recieve a message, but you're in a different window that taskbar section for that aim buddy will blink (plus the title bar of that un-focused window will blink as well)

how can one go about doing that in vb.net?
 

dynamic sysop

Member
Joined
Jun 27, 2004
Messages
10
Location
Ashby-De-La-Zouch, UK.
Programming Experience
5-10
use the FlashWindowEx API , here's a quick example i put together for you ...

VB.NET:
[size=2][color=#0000ff]Public [/color][/size][size=2][color=#0000ff]Structure[/color][/size][size=2] FLASHWINFO[/size]
[size=2][color=#0000ff]	Public[/color][/size][size=2] cbSize [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32[/size]
[size=2][color=#0000ff]	Public[/color][/size][size=2] hwnd [/size][size=2][color=#0000ff]As[/color][/size][size=2] IntPtr[/size]
[size=2][color=#0000ff]	Public[/color][/size][size=2] dwFlags [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32[/size]
[size=2][color=#0000ff]	Public[/color][/size][size=2] uCount [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32[/size]
[size=2][color=#0000ff]	Public[/color][/size][size=2] dwTimeout [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32[/size]
[size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]Structure[/color][/size]
 
 
[size=2][color=#0000ff]
[/color][/size][size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Declare [/color][/size][size=2][color=#0000ff]Function[/color][/size][size=2] FlashWindowEx [/size][size=2][color=#0000ff]Lib [/color][/size][size=2][color=#800080]"user32.dll"[/color][/size][size=2] ([/size][size=2][color=#0000ff]ByRef[/color][/size][size=2] pfwi [/size][size=2][color=#0000ff]As[/color][/size][size=2] FLASHWINFO) [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32[/size]
 
[size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Const[/color][/size][size=2] FLASHW_CAPTION [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32 = &H1[/size]
[size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Const[/color][/size][size=2] FLASHW_TRAY [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32 = &H2[/size]
[size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Const[/color][/size][size=2] FLASHW_ALL [/size][size=2][color=#0000ff]As[/color][/size][size=2] Int32 = (FLASHW_CAPTION [/size][size=2][color=#0000ff]Or[/color][/size][size=2] FLASHW_TRAY)
[/size]
[size=2][color=#0000ff]Private [/color][/size][size=2][color=#0000ff]Sub[/color][/size][size=2] Button1_Click([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] sender [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Object, [/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] e [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.EventArgs) [/size][size=2][color=#0000ff]Handles[/color][/size][size=2] Button1.Click
 
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] flash [/size][size=2][color=#0000ff]As [/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] FLASHWINFO[/size]
[size=2]flash.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(flash) [/size][size=2][color=#008000]'/// size of structure in bytes[/color][/size]
[size=2]flash.hwnd = [/size][size=2][color=#0000ff]MyBase[/color][/size][size=2].Handle [/size][size=2][color=#008000]'/// Handle to the window to be flashed[/color][/size]
[size=2]flash.dwFlags = FLASHW_ALL [/size][size=2][color=#008000]'/// to flash both the caption bar + the tray[/color][/size]
[size=2]flash.uCount = 5 [/size][size=2][color=#008000]'/// the number of flashes[/color][/size]
[size=2]flash.dwTimeout = 1000 [/size][size=2][color=#008000]'/// speed of flashes in MilliSeconds ( can be left out )[/color][/size]
[size=2][color=#008000]'/// flash the window you have specified the handle for...
[/color][/size][size=2]FlashWindowEx(flash)
 
[/size][size=2][color=#0000ff]End [/color][/size][size=2][color=#0000ff]Sub[/color][/size]
hope it helps you out :)
 
Top Bottom