Disabling alt menu
I made a Win32 C++ game that runs in a window. But when I press Alt the game pauses because Alt opens a menu. Then it resumes when I press Alt again. How can I disable this "Alt-checking". I need Alt to be usable in my game.
Thanks.
Disabling the SC_KEYMENU command in a WM_SYSCOMMAND message seems to do the trick:
Just tested it, and i think it does what you're asking for.
Make sure you return DefWindowProc() for any syscommand you don't handle, otherwise you'll disable alot more things than you intended.
LRESULT CALLBACK WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (msg) { case WM_SYSCOMMAND: { switch (wParam & 0xFFF0) { case SC_KEYMENU: { return 0; }break; default: { return DefWindowProc(hWnd, msg, wParam, lParam); } break; } } break; default: { return DefWindowProc(hWnd, msg, wParam, lParam); } } return 0; }
Just tested it, and i think it does what you're asking for.
Make sure you return DefWindowProc() for any syscommand you don't handle, otherwise you'll disable alot more things than you intended.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement