Fix keyboard layout fetch issue

This commit is contained in:
Jack251970 2025-03-22 13:58:53 +08:00
parent 023ab45022
commit 465108a9d4

View file

@ -371,9 +371,8 @@ namespace Flow.Launcher.Infrastructure
if (enHKL == HKL.Null) return;
// Get the current window thread ID
uint threadId = 0;
var result = PInvoke.GetWindowThreadProcessId(PInvoke.GetForegroundWindow(), &threadId);
if (result == 0 || threadId == 0) throw new Win32Exception(Marshal.GetLastWin32Error());
var threadId = PInvoke.GetWindowThreadProcessId(PInvoke.GetForegroundWindow());
if (threadId == 0) throw new Win32Exception(Marshal.GetLastWin32Error());
// Backup current keyboard layout
if (backupPrevious)