Virtual Keys :: MFC

kuphryn

Senior member
Jan 7, 2001
400
0
0
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
 

Adrian Tung

Golden Member
Oct 10, 1999
1,370
1
0
I currently don't have access to the MSDN library, but if you check, I think one or both of those functions (OnKeyDown and OnChar) will also give you a flag that you can use to determine whether Ctrl is down.

Another method which I like to use is to use GetAsyncKeyState to check for Ctrl in one of those functions.


:)atwl
 

javathehut

Senior member
Oct 23, 2000
318
0
0
u may want to try adding accelerators in ur resource. Make sure to load them into ur main dialog/sdi window by overriding the PretranslateMessage function sent out by CWnd.

Hope that helps