|
-
January 25th, 2000, 02:12 PM
#1
Monitoring right clicks and right double clicks
I was wondering what the sub would be to monitor if a user right clicks (actually right double-clicks) on a control. Any help would be greatly appreciated.
Thanks,
-
January 25th, 2000, 02:18 PM
#2
Re: Monitoring right clicks and right double clicks
You can easily get the right click using the mousedown event and checking if the Button variable is 2.
DblClick event always fires if you do a doubleclick on you control even if it is with a left or right button.
You can trap both events. The first one fired is the MouseDown and then comes the DblClick. Check the Button from MouseDown, make a boolean true if Button=2 and the check the doubleclick if this boolean is true to do your action.
-
January 25th, 2000, 02:26 PM
#3
Re: Monitoring right clicks and right double clicks
You could use a Couple of Timer Controls and the GetAsyncKeyState API to monitor Clicks in the O/S, ie.
private Declare Function GetAsyncKeyState Lib "user32" (byval vKey as Long) as Integer
private Const VK_LBUTTON = &H1
private Const VK_RBUTTON = &H2
private bClick as Boolean
private Sub Form_Load()
Timer1.Interval = 100
Timer1.Enabled = true
End Sub
private Sub Timer1_Timer()
If GetAsyncKeyState(VK_RBUTTON) then
While GetAsyncKeyState(VK_RBUTTON)
Wend
If bClick then
'Double Right Click Code Here
bClick = false
Timer2.Enabled = false
Caption = "Double Click"
else
'First Right Click, Watch for Possible 2nd
Timer2.Interval = 200
Timer2.Enabled = true
bClick = true
End If
End If
End Sub
private Sub Timer2_Timer()
'Single Right Click Code Here
Timer2.Enabled = false
Caption = "Click"
bClick = false
End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]
-
January 25th, 2000, 02:43 PM
#4
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
|