 |
vbgen Level: Moderator
 Registered: 10-10-2002 Posts: 876
|
Re: How do you simulate a right-click?
I'm not sure what you're asking, Dalgar..
Do this:
Start a new project, and create menu..
Go to the form's code..
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then 'left button was clicked
PopupMenu 'place the menu name here
Else
If Button = 2 Then 'right button was clicked
PopupMenu 'place the menu name here
End If
End If
End Sub |
____________________________
Been busy trying to take a second degree <--it's not working out...
|
|
10-08-2003 at 03:34 PM |
|
|
Asim-GDI GURU Level: Sage
 Registered: 29-07-2005 Posts: 54
|
Re: How do you simulate a right-click?
Hey dear I found the solution to your problem.what about an already made module for doing the work you want to do.
make a module and copy the following code in it
Attribute VB_Name = "Module1"
'Created by Stavros Korokithakis
Option Explicit
Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Public Const MOUSE_MOVED = &H1
Public Const MOUSEEVENTF_ABSOLUTE = &H8000
Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Const MOUSEEVENTF_MIDDLEDOWN = &H20
Public Const MOUSEEVENTF_MIDDLEUP = &H40
Public Const MOUSEEVENTF_MOVE = &H1
Public Const MOUSEEVENTF_RIGHTDOWN = &H8
Public Const MOUSEEVENTF_RIGHTUP = &H10
Sub ClickIt(x As Long, y As Long, Btn As Integer)
'Call this with x,y being coordinates, and button the button
'
'1 is Left button
'2 is Middle Button
'3 is Right Button
SetCursorPos x, y
Select Case Btn
Case 1
mouse_event &H6, 0, 0, 3, 3
Case 2
mouse_event &H60, 0, 0, 3, 3
Case 3
mouse_event &H18, 0, 0, 3, 3
End Select
End Sub
Regards,
Asim Siddiqui..
|
|
17-08-2005 at 01:08 PM |
|
|
|
|
 |
 |