Message 1 of 2
GetAsyncKeyState not working with Right Click

Not applicable
06-28-2007
02:21 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I thought this used to work
Now it doesn't seem to
What am I forgetting?
'(in AutoCad vba) but I should think vb would be similar except for the
KeyCodeConstants.vbKeyRButton reference ( = 2)
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As
Integer
Private Const VK_RMC = KeyCodeConstants.vbKeyRButton
Public Function UserRightClicked() As Boolean
If (0 > GetAsyncKeyState(VK_RMC)) Then UserRightClicked = True
End Function
by doesn't seem to work, I mean when used in an error trap it says I didn't
hit right click when I did!
eg
On Error GoTo ErrCtl
....ask for selection from user
oDoc.Utility.GetEntity oEnt, vpt, "Pick text or block "
... if user hits right click selection fails with error sending us to ErrCtl
... I should get msgBox "right" but I don't....
ErrCtl:
If UserRightClicked Then
MsgBox"Right"
Else
MsgBox"Nope"
End if
Now it doesn't seem to
What am I forgetting?
'(in AutoCad vba) but I should think vb would be similar except for the
KeyCodeConstants.vbKeyRButton reference ( = 2)
Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As
Integer
Private Const VK_RMC = KeyCodeConstants.vbKeyRButton
Public Function UserRightClicked() As Boolean
If (0 > GetAsyncKeyState(VK_RMC)) Then UserRightClicked = True
End Function
by doesn't seem to work, I mean when used in an error trap it says I didn't
hit right click when I did!
eg
On Error GoTo ErrCtl
....ask for selection from user
oDoc.Utility.GetEntity oEnt, vpt, "Pick text or block "
... if user hits right click selection fails with error sending us to ErrCtl
... I should get msgBox "right" but I don't....
ErrCtl:
If UserRightClicked Then
MsgBox"Right"
Else
MsgBox"Nope"
End if