Jump to content
  • Advertisement
Sign in to follow this  
asdqwe

Disabling alt menu

This topic is 4352 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
Advertisement
Guest Anonymous Poster
Don't have a menu.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!