win32gui.GetForegroundWindow

HWND = GetForegroundWindow()