[DllImport("user32.dll")]
static extern IntPtr GetActiveWindow();
<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function GetActiveWindow() As IntPtr
End Function
Public Declare Function GetActiveWindow Lib "user32.dll" () As Long
None.
GetActiveWindow() will only return if the calling thread is in focus.
Can be used to find the active window Hwnd for GetWindowText
Inside a Windows Form:
if (GetActiveWindow() == Handle) {
// The Form is the active window
}
Do you know one? Please contribute it!