Simple problem, normally a program will produce a MessageBeep if the user presses Alt+Whatever and there's no hotkey associated with it. What API functions can I call to avoid this?
Handl开发者_运维技巧ing WM_KEYDOWN, WM_KEYUP, WM_SYSKEYDOWN, and WM_SYSKEYUP all with return 0; on my main WndProc does not work.
WM_MENUCHAR should be what your looking for. MSDN search is you friend (>message beep shortcut< or >message beep accelerator<).
http://msdn.microsoft.com/en-us/library/ms646349(VS.85).aspx
Edit: seems to be only for active menus.
Edit 2: works like a charm. note MSDN:
An application that processes this message should return one of the following values in the high-order word of the return value.
I've used MNC_CLOSE << 16
.
I think this is a system setting. Control Panel + Sounds + Sounds tab. Not sure which one does it, I have a lot of them turned off. Maybe "Program Error".
精彩评论