I'm trying to do this:
And it isn't sending the mouse clicks to internet explorer. What am I doing wrong? I even tried sending a WM_CLOSE message. Do I need to define these messages????
Code:
Dim test As Long
lngR = FindWin(vbNullString, "caption at top of internet explorer")
test = SendMessage(lngR, WM_LBUTTONDOWN, 0, -1)
DoEvents
Text = SendMessage(lngR, WM_LBUTTONUP, 0, -1)
DoEvents
Sleep (1500)
test = SendMessage(lngR, WM_LBUTTONDOWN, 0, -1)
DoEvents
Text = SendMessage(lngR, WM_LBUTTONUP, 0, -1)
End Sub
Private Function FindWin(WinTitle As String) As Long
Dim lhWnd As Long, sAns As String
Dim sTitle As String
lhWnd = Me.hWnd
sTitle = LCase(WinTitle)
Do
DoEvents
If lhWnd = 0 Then Exit Do
sAns = LCase$(GetCaption(lhWnd))
If InStr(sAns, sTitle) Then
FindWin = lhWnd
Exit Do
Else
FindWin = 0
End If
lhWnd = GetNextWindow(lhWnd, 2)
Loop
End Function
And it isn't sending the mouse clicks to internet explorer. What am I doing wrong? I even tried sending a WM_CLOSE message. Do I need to define these messages????