GetActiveWindow function

Retrieves the window handle to the active window attached to the calling thread's message queue.

Syntax

HWND GetActiveWindow(

);

Parameters

This function has no parameters.

Return Value

Type: HWND

The return value is the handle to the active window attached to the calling thread's message queue. Otherwise, the return value is NULL.

Remarks

To get the handle to the foreground window, you can use GetForegroundWindow.

To get the window handle to the active window in the message queue for another thread, use GetGUIThreadInfo.

Requirements

   
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See Also

Conceptual

GetForegroundWindow

GetGUIThreadInfo

Keyboard Input

Reference

SetActiveWindow