# Remember who has the focus # Maybe unnecessary. my $hwndActive = GetActiveWindow(); ## Give focus to the desktop to force the key sequence through the system input queue SetFocus( GetDesktopWindow() ); ## Send the sequence SendKeys( ... ); ## Set the focus back to where it was... SetFocus( $hwndActive );