Tag Archives: FlashWindow

How to make the Applications Titlebar Flash

Click Star to Rate Post
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 1.00 out of 5)

Sometimes you may want to get the attention of your users and causing your apps titlebar is a good way to do so. There is a simple little Windows API call that will do this for you. (This little function can be used with all versions of Visual Basic. Just be sure to set the parameter types to the proper ones for whichever version you are using.) Below is the API declare for the FlashWindow function…

Declare for .NET

Private Declare Function FlashWindow Lib “user32? Alias “FlashWindow” (ByVal wHandle As Int32, ByVal invertStates As Boolean) As Int32

Declare for VB 6.0

PrivateDeclareFunction FlashWindow Lib "user32" Alias "FlashWindow" (ByVal wHandle As Long, ByVal invertStates As Boolean) As Long

All thats left to do it call this function with the handle of your application via the wHandle parameter. You will want to set the invert parameter to True which will make the titlebar flash while changing states.

FlashWindow(Me.Handle.ToInt32, True)

For Visual Basic 6.0 just use it like so…

FlashWindow Me.hWnd, True

If you want your window to flash multiple times, you can call the function in a timer control set to the interval for how often to flash. Otherwise you can use the – FlashWindowEx function. You should have no problems finding info for that function. It gives you more control over the flashing. I will go over that function at another time…