How to disable normal behaviour of Alt key?

前端 未结 1 1620
心在旅途
心在旅途 2021-02-06 07:12

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 m

相关标签:
1条回答
  • 2021-02-06 07:40

    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.

    0 讨论(0)
提交回复
热议问题