|
-
Sep 28th, 2000, 01:40 PM
#1
Thread Starter
Addicted Member
How do you make the mouse click/dbl-click outside of a VB form, like on the desktop? In otherwords how can I make the mouse click on desktop icons and/or start menu applications?
212 will lead you to the truth
-
Sep 30th, 2000, 06:55 AM
#2
Frenzied Member
Use the keyboard_event API Function.
-
Sep 30th, 2000, 09:14 AM
#3
Fanatic Member
-
Sep 30th, 2000, 11:56 AM
#4
Try the following
Code:
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Private Declare Function SetCursorPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Const MK_LBUTTON = &H1
Private Const WM_LBUTTONDBLCLK = &H203
Private Sub Command1_Click()
Dim PT As POINTAPI
Dim Wnd As Long
'Set the cursor position
SetCursorPos (Me.Top / 32) + 100, (Me.Left / 32) + 100
'Retrieve the cursor position
GetCursorPos PT
'Get the hWnd the mouse is over
Wnd = WindowFromPoint(PT.x, PT.y)
'Send a message to double click it
PostMessage Wnd, WM_LBUTTONDBLCLK, MK_LBUTTON, 0
End Sub
Private Sub Form_DblClick()
MsgBox "You double clicked the Form"
End Sub
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
|