Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

moucard

capturing a ctrl+o event

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

This problem should be easy to solve, but the VC++ documentation seemes confusing. I have a function that handles the keyboard input (WM_KEYDOWN from WndProc). In this function I have this code
if (wParam == ''O'') {
  // do this

}
Now I want to do something else if the user presses CTRL-O (do a file open to be exact. I don''t use menus though). I think that I should check the lParam but the following code doesn''t work:
if (wParam == ''O'') {
  if (lParam == VK_CONTROL) {
    // do something else

  }
  else {
    // do this

  }
}
Can anyone tell me how do I achieve this? Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
You could try accelerators. Look up: LoadAccerlerators, CreateAcceleratorTable and TranslateAccelerator.

Also, the lParam to WM_KEYDOWN is a set of bitfields so:
lParam == VK_CONTROL
will never return true (well, it might, but it won't be because the control key is pressed). If you want to use the WM_KEYDOWN message then GetASyncKeyState to check if the control key is pressed at the same time.

Skizz

[edited by - Skizz on June 4, 2004 7:30:59 AM]

Share this post


Link to post
Share on other sites

  • 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!