|
-
March 4th, 2008, 02:48 AM
#1
Detecting if 'Control' or 'Shift' key was down when key pressed
I have been looking into detecting key stuff, it works great, I am trying to figure out if control or shift was pressed, I read in some MSDN documentation (I use Visual C++), that lParam is 0 if ctrl or shift isn't down, or 1 if they are, but how do I tell which one?
I may be wrong, it had a table structure saying stuff like:
0-15 repeat count
16-18 reserved, do not use
19-23 = something
24 = if the right hand shift or control key is down on an extended 101-102 key keyboard.. returns 1 if it is, otherwise returns 0
My code for keys:
Code:
CASE WM_KEYDOWN:
{
if (LOWORD(lParam) == 1)
{
MessageBox(hWnd, _T("Ctrl Or Shift down"), _T("CAP"), 0);
}
int iKey = LOWORD(wParam);
if (iKey == 37) //LEFT ARROW
{
MessageBox(hWnd, _T("LA"), _T("CAP"), 0);
}
else if (iKey == 39) //RIGHT ARROW
{
MessageBox(hWnd, _T("RA"), _T("CAP"), 0);
}
}
I get the message Ctrl Or Shift down, when I hold either of them down, but I don't if I don't hold them down...
How do I tell which one was pressed? Thanks
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
|