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.
Namespace: DevCase.Win32.NativeMethodsAssembly: 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()
<DllImportAttribute("User32.dll", SetLastError := true>]
Public Shared Function GetForegroundWindow As IntPtr
Dim returnValue As IntPtr
returnValue = User32.GetForegroundWindow()
public:
[DllImportAttribute(L"User32.dll", SetLastError = true)]
static IntPtr GetForegroundWindow()
[<DllImportAttribute("User32.dll", SetLastError = true)>]
static member GetForegroundWindow : unit -> IntPtr
No code example is currently available or this language may not be supported.
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.