FlashWindow

Syntax

BOOL FlashWindow(hWnd,bInvert)

This function “flashes” the given window once. Flashing a window means changing the appearance of its caption bar as if the window were changing from inactive to active status, or vice versa. (An inactive caption bar changes to an active caption bar; an active caption bar changes to an inactive caption bar.)

Typically, a window is flashed to inform the user that the window requires attention, but that it does not currently have the input focus.

Parameter Type/Description  

hWnd HWND Identifies the window to be flashed. The window can be either open or iconic.  
bInvert BOOL Specifies whether the window is to be flashed or returned to its original state. The window is flashed from one state to the other if the bInvert parameter is nonzero. If the bInvert parameter is zero, the window is returned to its original state (either active or inactive).  

Return Value

The return value specifies the window's state before call to the FlashWindow function. It is nonzero if the window was active before the call. Otherwise, it is zero.

Comments

The FlashWindow function flashes the window only once; for successive flashing, the application should create a system timer.

The bInvert parameter should be zero only when the window is getting the input focus and will no longer be flashing; it should be nonzero on successive calls while waiting to get the input focus.

This function always returns a nonzero value for iconic windows. If the window is iconic, FlashWindow will simply flash the icon; bInvert is ignored for iconic windows.