FlashWindow Function

Declare Function FlashWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal bInvert As Long) As Long

Platforms: Win 32s, Win 95/98, Win NT

FlashWindow flashes a window one step. Flashing is where the title bar of the window is switched from an active to inactive look (or vice versa) to get the user's attention. Normally this is done multiple times, instead of just once. When you are done flashing, be sure to call the function again, this time with bInvert set to 0. The function returns 0 if the window's look was inactive before flashing, or 1 if its look was active.

hwnd
The handle of the window to flash one step.
bInvert
Specifies how to flash. If non-zero, switches the title bar from an active to inactive look (or vice versa). If zero, restores the window to its normal look.

Example:

' Flash Form1 five times to get the user's attention
Dim c As Integer, retval As Long  ' counter variable & return value

For c = 1 To 10  ' flash on five times, off five times
  retval = FlashWindow(Form1.hWnd, 1)  ' toggle the look of the window
  Sleep 500  ' halt execution for 500 milliseconds (1/2 minute)
Next c
retval = FlashWindow(Form1.hWnd, 0)  ' make sure the window looks normal

Category: Windows

Go back to the alphabetical Function listing.
Go back to the Reference section index.


This page is copyright © 2000 Paul Kuliniewicz. Copyright Information.
Go back to the Windows API Guide home page.
E-mail: vbapi@vbapi.com Send Encrypted E-Mail
This page is at http://www.vbapi.com/ref/f/flashwindow.html