User32GetForegroundWindow Method

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.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", SetLastError = true)]
public static IntPtr GetForegroundWindow()

Return Value

IntPtr
The return value is a handle to the foreground window.

The foreground window can be Zero in certain circumstances, such as when a window is losing activation.

Remarks

See Also