SHIFT / CONTROL Key Held? 
Author Message
 SHIFT / CONTROL Key Held?

How can I interpret whether a ALT,  SHIFT or CONTROL key is being pressed?

I have a function, and while it is running, I would like to interpret
whether Alt, R/L shift or R/L control is being held at a given instant...
depending on one of the state of the keyboard, the code branches in
different direction?

I am trying to implement functionality similar to, i.e., Adobe Illustrator,
that when Shift-picking, lines, etc ,are constrained to 45deg angles, or
when alt drawing an ELLIPSE, you can draw a perfect circile .. i.e, but if
you release the key, the constraint is gone... however, I may only need to
check at the instant that the left-mouse button is clicked.

Also, Can Windows tell the difference between Right & Left Shift/CTRL?



Sat, 17 Dec 2005 23:09:25 GMT  
 SHIFT / CONTROL Key Held?
Hi,

Quote:

> How can I interpret whether a ALT,  SHIFT or CONTROL key is being pressed?
> Also, Can Windows tell the difference between Right & Left Shift/CTRL?

Have a try;

GetAsyncKeyState
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterf...

or

GetKeyState
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterf...

--
Ueta System Design Studio
http://www1.odn.ne.jp/usdesign/ (sorry, no English page)
UETA, Shin-ichi



Sat, 17 Dec 2005 23:30:35 GMT  
 SHIFT / CONTROL Key Held?
GetAsyncKeyState at "any instant". However, note that in the case you are talking about,
you can get some of the key information in the flags that come in to OnMouseMove or
OnLButtonDown. And since you only care about the state when the button went down,
GetKeyState will give you the key state as of the last keyboard/mouse message.

                        joe



Quote:
>How can I interpret whether a ALT,  SHIFT or CONTROL key is being pressed?

>I have a function, and while it is running, I would like to interpret
>whether Alt, R/L shift or R/L control is being held at a given instant...
>depending on one of the state of the keyboard, the code branches in
>different direction?

>I am trying to implement functionality similar to, i.e., Adobe Illustrator,
>that when Shift-picking, lines, etc ,are constrained to 45deg angles, or
>when alt drawing an ELLIPSE, you can draw a perfect circile .. i.e, but if
>you release the key, the constraint is gone... however, I may only need to
>check at the instant that the left-mouse button is clicked.

>Also, Can Windows tell the difference between Right & Left Shift/CTRL?

Joseph M. Newcomer [MVP]

Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm


Sun, 18 Dec 2005 00:24:20 GMT  
 SHIFT / CONTROL Key Held?
In GetAsyncKeyState
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterf...

SHORT GetAsyncKeyState(
    int vKey
);

it states: If the most significant bit is set, the key is down

What is the most straight forward way to check the SHORT if the MSB is set?

Thanks,
MS


Quote:
> Hi,


> > How can I interpret whether a ALT,  SHIFT or CONTROL key is being
pressed?
> > Also, Can Windows tell the difference between Right & Left Shift/CTRL?

> Have a try;

> GetAsyncKeyState

http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterf...
Quote:

> or

> GetKeyState

http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterf...
Quote:

> --
> Ueta System Design Studio
> http://www1.odn.ne.jp/usdesign/ (sorry, no English page)
> UETA, Shin-ichi




Sun, 18 Dec 2005 00:44:07 GMT  
 SHIFT / CONTROL Key Held?

Quote:

> What is the most straight forward way to check the SHORT if the MSB is set?

Just like this;

    BOOL bShift = (GetAsyncKeyState(VK_SHIFT) < 0);

--
Ueta System Design Studio
http://www1.odn.ne.jp/usdesign/ (sorry, no English page)
UETA, Shin-ichi



Sun, 18 Dec 2005 01:05:13 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Left Shift Key OR Right Shift key is pressed

2. know when shift or control keys are pressed and unpressed

3. Capturing the Ctl- and Shift-Arrow keys in an OLE control

4. Detecting if "Shift" is held down

5. Detecting if "Shift" is held down

6. Pressing and holding a key

7. HELP: Get shift-cursor key combination.

8. unix shift keys

9. Sending WM_KEYDOWN for SHIFT+TAB keys

10. Detect shift key state using a macro?

11. How to detect Shift+key ?

12. SHIFT Key

 

 
Powered by phpBB® Forum Software