class #32770Private Declare Function FindWindowEx Lib "user32" _ Alias "FindWindowExA" (ByVal hWnd1 As Long, _ ByVal hWnd2 As Long, ByVal lpsz1 As String, _ ByVal lpsz2 As String) As Long Private Declare Function SendMessage Lib "user32" _ Alias "SendMessageA" (ByVal hWnd As Long, _ ByVal wMsg As Long, ByVal wParam As Long, _ ByVal lParam As String) As Long Private Declare Function FindWindow Lib "user32" _ Alias "FindWindowA" (ByVal lpClassName As String, _ ByVal lpWindowName As String) As LongFunction CloseSystemConfirmDlg() As Boolean Dim IEDialogHwnd As Long IEDialogHwnd = FindWindow("#32770", "Microsoft Internet Explorer") If IEDialogHwnd = 0 Then '不同版本的IE标题有差异 IEDialogHwnd = FindWindow("#32770", "Windows Internet Explorer") End If If IEDialogHwnd Then CloseSystemConfirmDlg = True Call SendMessage(FindWindowEx(IEDialogHwnd, ByVal 0&, "Button", "确定"), &HF5, 0, 0) Call SendMessage(FindWindowEx(IEDialogHwnd, ByVal 0&, "Button", "确定"), &HF5, 0, 0) End If End Function
然后再向按钮sendkey ???没有更简单的方法了吗?webbrowser里面没有ie弹出窗口的属性方法类???
Alias "FindWindowExA" (ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, ByVal lpsz1 As String, _
ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" _
Alias "SendMessageA" (ByVal hWnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, _
ByVal lParam As String) As Long
Private Declare Function FindWindow Lib "user32" _
Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As LongFunction CloseSystemConfirmDlg() As Boolean
Dim IEDialogHwnd As Long
IEDialogHwnd = FindWindow("#32770", "Microsoft Internet Explorer")
If IEDialogHwnd = 0 Then '不同版本的IE标题有差异
IEDialogHwnd = FindWindow("#32770", "Windows Internet Explorer")
End If
If IEDialogHwnd Then
CloseSystemConfirmDlg = True
Call SendMessage(FindWindowEx(IEDialogHwnd, ByVal 0&, "Button", "确定"), &HF5, 0, 0)
Call SendMessage(FindWindowEx(IEDialogHwnd, ByVal 0&, "Button", "确定"), &HF5, 0, 0)
End If
End Function