is there an event associated with the right mouse button?
i need to make the right mouse button click programmatic in my application on visual basic. is there a way? the idea is that we preset
the time up to the millisecond accuracy and let the right mouse click on that time programmatic . please help...

Not quite sure what you are after but the mouse down and mouse up events have a button argument that allow you to test for which mouse button was pressed. For milliseconds look at the GetTickCount API.

Good Luck

There is an option to add event on right mouse button

Dim a As Integer
Dim b As Integer
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
a = a + 1
Label1.Caption = "Right Mouse button Down " & a
ElseIf Button = vbLeftButton Then
b = b + 1
Label1.Caption = "Left Mouse Button Down " & b
End If
End Sub

In time case i think just copy the code in Right Mouse Button to a time control and set the time to tick.
OR
Give a hidden button and write the code in that command button event.After that please activate that button when the time ticks and Right mouse button down.
I tried like this :

Dim a As Integer

Private Sub Command1_Click()
a = a + 1
Label1.Caption = "Right Mouse button Down " & a
End Sub

Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbRightButton Then
Command1 = True
End If
End Sub

Private Sub Timer1_Timer()
Command1 = True
End Sub

Ok try it ...

This article has been dead for over six months. Start a new discussion instead.