关于vbs WebBrowser导航问题
程序员文章站
2022-07-04 20:39:46
实际上属于转贴。。呵呵:-) 原始文章来自微软,微软么,是大家的微软嘛!所以稍微修改了一下,帖到这里。 原文的中文地址是: http://support.microsoft...
实际上属于转贴。。呵呵:-)
原始文章来自微软,微软么,是大家的微软嘛!所以稍微修改了一下,帖到这里。
原文的中文地址是:
http://support.microsoft.com/kb/185538/zh-cn
实际上,这个实现就是获取一个接口,还是叫事件吧。。。。更明显,反正我是分不清这些东西的。
dim withevents web_v1 as shdocvwctl.webbrowser_v1
163的链接一般都是弹出窗口,就用163吧
private sub form_load()
set web_v1 = webbrowser1.object
webbrowser1.navigate2 "http://www.163.com/"
end sub
如果你想知道弹出窗口的url呢,那就
private sub web_v1_newwindow(byval url as string, _
byval flags as long, _
byval targetframename as string, _
postdata as variant, _
byval headers as string, _
processed as boolean)
processed = false
msgbox url
end sub
如果你想让弹出窗口在原来的窗体里显示呢,就
private sub web_v1_newwindow(byval url as string, _
byval flags as long, _
byval targetframename as string, _
postdata as variant, _
byval headers as string, _
processed as boolean)
processed = true
webbrowser1.navigate url
end sub
原始文章来自微软,微软么,是大家的微软嘛!所以稍微修改了一下,帖到这里。
原文的中文地址是:
http://support.microsoft.com/kb/185538/zh-cn
实际上,这个实现就是获取一个接口,还是叫事件吧。。。。更明显,反正我是分不清这些东西的。
dim withevents web_v1 as shdocvwctl.webbrowser_v1
163的链接一般都是弹出窗口,就用163吧
private sub form_load()
set web_v1 = webbrowser1.object
webbrowser1.navigate2 "http://www.163.com/"
end sub
如果你想知道弹出窗口的url呢,那就
private sub web_v1_newwindow(byval url as string, _
byval flags as long, _
byval targetframename as string, _
postdata as variant, _
byval headers as string, _
processed as boolean)
processed = false
msgbox url
end sub
如果你想让弹出窗口在原来的窗体里显示呢,就
private sub web_v1_newwindow(byval url as string, _
byval flags as long, _
byval targetframename as string, _
postdata as variant, _
byval headers as string, _
processed as boolean)
processed = true
webbrowser1.navigate url
end sub
上一篇: 把任意文件转成vbs文件的file2vbs的vbs代码
下一篇: 性别都可以改变的时代