getactivewindow (user32)
Last changed: -85.182.208.90

.
Summary

C# Signature:

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

VB.NET Signature:

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

VB Signature:

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

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() == Handle) {
    // The Form is the active window
}

Alternative Managed API:

Do you know one? Please contribute it!

Documentation