mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #3461 from Flow-Launcher/keyboard_win32_exception
Fix possible win32 exception
This commit is contained in:
commit
62935dbd0e
1 changed files with 2 additions and 1 deletions
|
|
@ -376,7 +376,8 @@ namespace Flow.Launcher.Infrastructure
|
|||
if (!IsForegroundWindow(hwnd))
|
||||
{
|
||||
var result = PInvoke.SetForegroundWindow(hwnd);
|
||||
if (!result) throw new Win32Exception(Marshal.GetLastWin32Error());
|
||||
// If we cannot set the foreground window, we can use the foreground window and switch the layout
|
||||
if (!result) hwnd = PInvoke.GetForegroundWindow();
|
||||
}
|
||||
|
||||
// Get the current foreground window thread ID
|
||||
|
|
|
|||
Loading…
Reference in a new issue