Normally the Alt key opens the menu in Windows.
I need this to be disabled, because I need Alt key for my application. (It is an emulator of old computer, so I need to mimic its behaviour.) I write it in pure Windows API, so I expect there must be some message which is sent and needs to be disabled, discarded or ignored.
Alt+Tab is no problem, as well as other system keys and key combinations, I just need to ignore Alt when it opens the menu.
(My application uses DirectInput to read the keys, so it works well. I just need to disable the functionality which opens the menu with Alt key. I will open the menu using mouse.)
The default mode is turned on. However, workarounds are available depending on what you plan to do with the Alt Gr key. 1] If you have an Alt Gr key on your computer, you can disable it by pressing the shift key and the control key at the same time.
The reason your Left Alt key and Windows key have switched functions is likely that you are using a wireless keyboard that has two modes: Windows and Mac Mode. So, to fix this you need to find a switch on your keyboard and toggle it to Windows/Android mode.
How about checking for WM_SYSCOMMAND
, and when wParam is SC_KEYMENU
, return 0?
Update / exact solution:
if(wParam==SC_KEYMENU && (lParam>>16)<=0) return 0;
return DefWindowProc(hwnd, message, wParam, lParam);
Description: If lParam>>16
is positive then menu is activated by mouse, when it is zero or negative then menu is activated by Alt or Alt+something.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With