|
-
March 4th, 2008, 10:11 PM
#3
Re: Detecting if 'Control' or 'Shift' key was down when key pressed
Hi Icyculyr,
I have been reading information about keyboard messages recently, at one point, I was exposed to the topic you are investigating.
Like Boris K K suggested, you can use GetKeyState( virtual key) to discover if a shift key, such as SHIFT, CTRL, and ALT, is pressed.
For example,
Code:
nRet = GetKeyState ( VK_SHIFT ) ;
You can obtain a more detailed usage on MSDN GetKeyState () ;
However, according to the book I was reading, it mentioned a flaw of using GetKeyState. GetKeyState does not check keyboard status in real-time.
It refects the keyboard status up to and including the current message being processed.
If this is not what you want, you can also check VK_SHIFT at WM_KEYDOWN
Hope this helps.
kab
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|