View Single Post
Old 07-18-2008, 12:47 PM   #9
ClockWorK
Newbie
 
ClockWorK's Avatar
 
Join Date: Oct 2003
Location: Michigan
Posts: 43
Here's how I click on a control in another app through code. All you need is the handle.

Code:
''''''' Private Declare Function SendMessage_Long Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef LParam As Long) As Long Private Const WM_LBUTTONDOWN As Long = &H201 Private Const WM_LBUTTONUP As Long = &H202 Private Const WM_KEYUP As Long = &H101 Private Const WM_KEYDOWN As Long = &H100 Private Const VK_SPACE As Long = &H20 '''''''' Public Sub WindowAPI_Click(ByVal hwnd As Long) Dim retVal As Long retVal = SendMessage_Long(hwnd, WM_LBUTTONDOWN, 0&, ByVal 0&) retVal = SendMessage_Long(hwnd, WM_LBUTTONDOWN, 0&, ByVal 0&) retVal = SendMessage_Long(hwnd, WM_KEYUP, VK_SPACE, ByVal 0&) retVal = SendMessage_Long(hwnd, WM_LBUTTONUP, 0&, ByVal 0&) End Sub

ClockWorK is offline   Reply With Quote