在CSDN的一篇帖子转了一下
某些网页出于各种考虑会弹出对话框要求信息确认,往往会中断我们的webbrowser过程,可以使用如下方法:
1.加入Microsoft Html Object
2.加入语句
而confirm引发的对话确定框可用confirm替换showModalDialog即可,Alert等同理~
Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
Dim obj As HTMLDocument
Set ōbj = pDisp.Document
obj.parentWindow.execscrīpt "function showModalDialog(){return;}" ''对showModalDialog引起的对话框进行确定
End Sub
另一种方法在CSDN看到的方法,过个记录(未尝试)
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
ShellExecute frmDisplay.hwnd, vbNullString, "http://www.sina.com", vbNullString, vbNullString, SW_SHOWNORMAL