use 5.010001; my $hwnd = GetDesktopWindow(); my $focus_id = GetFocus($hwnd); say $focus_id;