GetActiveWindow (user32)
Last changed: sim2kid-174.69.1.142

.
Summary

C# Signature:

[DllImport("user32.dll")]
static extern IntPtr GetActiveWindow();

VB Signature:

<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function GetActiveWindow() As IntPtr
End Function

Alternate VB Signature:

Public Declare Auto Function GetActiveWindow Lib "user32.dll" () As IntPtr

User-Defined Types:

None.

Notes:

Please add some!

Tips & Tricks:

Can be used to find the active window Hwnd for GetWindowText

Sample Code:

Inside a Windows Form:

if (GetActiveWindow() == e.Handle) {
    // The Form is the active window
}

Alternative Managed API:

Do you know one? Please contribute it!

Documentation