[win32] Some fixes for persistent mode

Use SetForegroundWindow instead of deprecated SwitchToThisWindow.