Function Reference


Flashes the specified window

#include <WinAPI.au3>
_WinAPI_FlashWindowEx ( $hWnd [, $iFlags = 3 [, $iCount = 3 [, $iTimeout = 0]]] )


$hWnd Handle to the window to be flashed. The window can be either open or minimized.
$iFlags [optional] The flash status. Can be one or more of the following values:
    0 - Stop flashing. The system restores the window to its original state.
    1 - Flash the window caption
    2 - Flash the taskbar button
    4 - Flash continuously until stopped
    8 - Flash continuously until the window comes to the foreground
$iCount [optional] The number of times to flash the window
$iTimeout [optional] The rate at which the window is to be flashed, in milliseconds.
If 0, the function uses the default cursor blink rate.

Return Value

Success: True
Failure: False


Typically, you flash a window to inform the user that the window requires attention but does not currently have the keyboard focus.
When a window flashes, it appears to change from inactive to active status.
An inactive caption bar changes to an active caption bar; an active caption bar changes to an inactive caption bar.



See Also

Search FlashWindowEx in MSDN Library.


#include <GUIConstantsEx.au3>
#include <WinAPI.au3>


Func Example()
    Local $hWnd, $idFlash, $idTimeout, $idBtnFlash, $iMsg, $iFlashrate, $iTimeoutrate, $bFlashing = False
    $hWnd = GUICreate("Form1", 229, 170, 193, 125)
    $idFlash = GUICtrlCreateInput("20", 80, 72, 121, 21)
    $idTimeout = GUICtrlCreateInput("500", 80, 103, 121, 21)
    GUICtrlCreateLabel("Please input the flash rate, and the time between flashes", 8, 24, 214, 41)
    GUICtrlCreateLabel("Flash Rate:", 16, 72, 58, 17)
    GUICtrlCreateLabel("Timeout (ms)", 16, 104, 64, 17)
    $idBtnFlash = GUICtrlCreateButton("Flash Window", 80, 136, 75, 25, 0)

    While 1
        $iMsg = GUIGetMsg()
        Switch $iMsg
            Case $GUI_EVENT_CLOSE
            Case $idBtnFlash
                If $bFlashing Then
                    _WinAPI_FlashWindowEx($hWnd, 0)
                    $bFlashing = False
                    $iFlashrate = GUICtrlRead($idFlash)
                    $iTimeoutrate = GUICtrlRead($idTimeout)
                    _WinAPI_FlashWindowEx($hWnd, 2, $iFlashrate, $iTimeoutrate)
                    GUICtrlSetData($idBtnFlash, "Stop Flashing")
                    $bFlashing = True
EndFunc   ;==>Example