I have been trying this for around 2 and a half hours now, to no avail. For whatever reason, the program I am sending the click to ( Firefox ) isn't reacting. It is supposed to click one of those option box things. I am totally clueless as to why it won't work..![]()
I am always getting a correct parent/child value, so that isn't the problem. I am also positive that my X,Y coords are correct.Code:Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long Private Const WM_LBUTTONDOWN = &H201 Private Const WM_LBUTTONUP = &H202 Private Const GW_CHILD = 5 Private hWndParent As Long Private hWndChild As Long '-----------------------------------------------------------------------------' Public Sub SendClick(lnghWND As Long, x As Long, y As Long) Dim iResult As Long Dim lParam As Long lParam = (y * &H10000) + x Debug.Print "lParam is: " & lParam & " || lnghWND is: " & lnghWND & " || x is: " & x & " || y is: " & y iResult = SendMessage(lnghWND, WM_LBUTTONDOWN, 0&, ByVal lParam) iResult = SendMessage(lnghWND, WM_LBUTTONUP, 0&, ByVal lParam) End Sub Private Sub Command2_Click() Debug.Print hWndChild Call SendClick(hWndChild, 296, 701) End Sub Private Sub Form_Load() hWndParent = FindWindow(vbNullString, "Index - Mozilla Firefox") hWndChild = GetWindow(hWndParent, GW_CHILD) Debug.Print "parent: " & hWndParent Debug.Print "child: " & hWndChild End Sub
Any help is appreciated.




Reply With Quote