Prevent the error/beep sound when alt+number/letter is pressed on windows

This commit is contained in:
qianlifeng 2024-11-14 00:01:33 +08:00
parent 42586c9e05
commit 7a6ec18a35
2 changed files with 11 additions and 6 deletions

View File

@ -2,7 +2,4 @@ pre-commit:
commands: commands:
go-vet: go-vet:
root: "Wox/" root: "Wox/"
run: go vet run: go vet
ui-build:
root: "Wox.UI.React/"
run: pnpm build

View File

@ -45,8 +45,16 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
} }
window.SetQuitOnClose(true); window.SetQuitOnClose(true);
::MSG msg; ::MSG msg = { };
while (::GetMessage(&msg, nullptr, 0, 0)) { while (::GetMessage(&msg, nullptr, 0, 0) > 0) {
// prevent the error/beep sound when alt+number/letter is pressed
if (msg.message == WM_SYSKEYDOWN) {
msg.message = WM_KEYDOWN;
::TranslateMessage(&msg);
::DispatchMessage(&msg);
continue;
}
::TranslateMessage(&msg); ::TranslateMessage(&msg);
::DispatchMessage(&msg); ::DispatchMessage(&msg);
} }