# Function Reference

# _WinAPI_GetForegroundWindow

Returns the handle of the foreground window

#include <WinAPISysWin.au3>
_WinAPI_GetForegroundWindow ( )

## Return Value

Success: | Handle of the foreground window
Failure: | The foreground window can be NULL in certain circumstances, such as when a window is losing activation

## See Also

Search GetForegroundWindow in MSDN Library.

## Example

    #include <MsgBoxConstants.au3>
    #include <WinAPISysWin.au3>

    MsgBox($MB_SYSTEMMODAL, "Handle", "Get Foreground Window: " & _WinAPI_GetForegroundWindow())