Click to See Complete Forum and Search --> : Q: Is SHIFT key pressed?


Daniel B. Sigurgeirsson
April 1st, 1999, 12:25 PM
Hi everyone.


I'm working on a subclassed CEdit control (actually the well-known CInPlaceEdit found here at Codeguru) and I have a very simple (hopefully) question about the OnChar method.


How do I tell if the Shift key is also pressed? I want to process the Tab key and similarly I want to process the Shift+Tab key combination.


There is this UINT nFlags thingy but does that tell me anything I want to know?


I've tried to use GetKeyState( VK_SHIFT ) and GetAsyncKeyState( VK_SHIFT ) but somehow that also returns nonzero if the shift key has been pressed at any time during the lifetime of the control.


Any ideas?


With best regards,

Daniel B. Sig.

deep
April 1st, 1999, 01:11 PM
Because there is not necessarily a one-to-one correspondence between keys pressed and OnChar calls generated, the information in nFlags is generally not useful to applications. The information in nFlags applies only to the most recent call to the OnKeyUp member function or the OnKeyDown member function that precedes the call to OnChar. -From MSDN Library


Regards

Deep