The GetActiveWindow function retrieves the window handle to the active window attached to the calling thread's message queue.
Syntax
HWND GetActiveWindow(VOID);
Return Value
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.
Windows 98/Me and Windows NT 4.0 SP3 and later: To get the window handle to the active window in the message queue for another thread, use GetGUIThreadInfo.
Function Information
| Minimum DLL Version | user32.dll |
|---|
| Header | Declared in Winuser.h, include Windows.h |
|---|
| Import library | User32.lib |
|---|
| Minimum operating systems |
Windows 95, Windows NT 3.1 |
|---|
See Also