Sign in to follow this  

Disabling alt menu

This topic is 4132 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Disabling the SC_KEYMENU command in a WM_SYSCOMMAND message seems to do the trick:


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.

Share this post


Link to post
Share on other sites

This topic is 4132 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this