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

@ -3,6 +3,3 @@ pre-commit:
go-vet:
root: "Wox/"
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);
::MSG msg;
while (::GetMessage(&msg, nullptr, 0, 0)) {
::MSG msg = { };
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);
::DispatchMessage(&msg);
}