Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, Byval LPSZ2 AS STRING) As longprivate declare function sendMessage lib "user32" alias "sendMessagea" (Byval HWnd As Long, Byval WParam As Long, LParam as ring) AS Long
Private const wm_lbuttondown = & h201private const wm_lbuttonup = & H202
Private Sub Form_Load () WebBrowser1.naviGate2 "http://popo.163.com/download.shtml "End Sub
Private Sub Timer1_Timer () Dim lngFrmHwnd As Long Dim lngBtnHwnd As Long lngFrmHwnd = FindWindow (vbNullString, "File Download - Security Warning") 'Modify window title If lngFrmHwnd> 0 Then lngBtnHwnd = FindWindowEx (lngFrmHwnd, ByVal 0 &, "BUTTON", vbNullString ) Endness, wm_lbuttondownload, byval 0 &, byval 0 & sendMessage LNGBTNHWND, WM_LBUTTONUP, BYVAL 0 &, BYVAL 0 & TIMER1.ENABLED = FALSE END IFEND SUB
Private sub webbrowser1_filedownload (Cancel as boolean) Timer1.Nabled = True Timer1.enabled = 100nd SUB