Virtual Keys :: MFC

Started by
2 comments, last by kuphryn 22 years, 1 month ago
Hi. I would like to know how to determine when the user presses, say, ''z'' *while* holding down one of the virtual keys, say Ctrl. For example // Ctrl + Z I can use either OnKeyDown(...) and/or OnChar(...) to determine *either* Ctrl or z, but not both. I am trying to implement an "undo" feature. Thanks, Kuphryn
Advertisement
I think you need to keep track of the state of ctrl.
There''s also a OnKeyUp - set a flag when ctrl goes down, unset it when ctrl goes up.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
Thanks.

I tried that, but it did not work either.

Kuphryn
My personal solution would be to use GetAsyncKeyState with VK_CONTROL while you process the VK_Z to determine whether or not Ctrl (or shift or anything else for that matter) is being pressed simultaneously.

-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~

This topic is closed to new replies.

Advertisement