GetActiveWindow function (winuser.h)
Retrieves the window handle to the active window attached to the calling thread's message queue.
C++
HWND GetActiveWindow();
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.
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.
Requirement | Value |
---|---|
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 |
API set | ext-ms-win-ntuser-window-l1-1-4 (introduced in Windows 10, version 10.0.14393) |
Conceptual
Reference