Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

GetForegroundWindow function

Retrieves a handle to the foreground window (the window with which the user is currently working). The system assigns a slightly higher priority to the thread that creates the foreground window than it does to other threads.

Syntax


HWND WINAPI GetForegroundWindow(void);

Parameters

This function has no parameters.

Return value

Type:

Type: HWND

The return value is a handle to the foreground window. The foreground window can be NULL in certain circumstances, such as when a window is losing activation.

Requirements

Minimum supported client

Windows 2000 Professional [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

See also

Reference
SetForegroundWindow
Conceptual
Windows

 

 

Community Additions

ADD
Show:
© 2015 Microsoft