Jump to content
  • Advertisement
Sign in to follow this  
Triad_prague

Using f10 keys in the game :(

This topic is 2615 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

Hi I'm trying to use the F10 games for quick slot bar in the game (use f1~f12). things work fine until.....I pressed the f10 keys. the game freezes for a while until I click inside the window. I wonder what's the correct ways of processing this key. oh btw the alt key does the same too (freezes the game until I click inside the window). I'm using windows message (WM_KEYDOWN and WM_KEYUP) approach if that helps

Does anyone know a "common" way to deal with it?

Thanks :D

Share this post


Link to post
Share on other sites
Advertisement
Try adding this to your window procedure:

[source lang=cpp]
case WM_SYSCOMMAND:
switch (wParam)
{
case SC_KEYMENU:
case SC_SCREENSAVE: //optional, prevents the screen saver from popping up
return 0;
}
break;
[/source]

Share this post


Link to post
Share on other sites
Your culprit is WM_SYSKEYDOWN (responsible for ALT and F10 keys - they both have to do with opening the app's menu, which can cause the freezing you're experiencing).

I can't remember what the correct way to handle it is, though... I guess you could try just returning 0 when you get that message (instead of letting it go to DefWindowProc). I seem to recall there are some ALT+? keys that you want to let through though.

(Edit) Ninja'd!

Share this post


Link to post
Share on other sites
thanks mussi, nypyren, your ideas helped me solved the problem. what I do is by processing WM_SYSKEYDOWN and WM_SYSKEYUP too and return 0 in the window procedure and process WM_SYSCOMMAND as mussi said. whew now it works good!

Thanks again :lol:

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!