动态创建浏览器的ole对象
integer result
oleobject objexplorer,iedoc
objexplorer = create oleobject
result = objexplorer.connecttonewobject( “internetexplorer.application”)
if result = 0 then
objexplorer.navigate(“about:blank”)
iedoc = objexplorer.document
objexplorer.toolbar = 0
objexplorer.statusbar = 0
objexplorer.width = 300
objexplorer.height = 150
objexplorer.left = 0
objexplorer.top = 0
objexplorer.visible = 1
end if
//这个可以执行js
oleobject wshshell
wshshell = create oleobject
wshshell.connecttonewobject( “wscript.shell”)
integer li_return
li_return = wshshell.run(“cscript e:\validate.js”, 1, true)
messagebox(“”,li_return)
wshshell.disconnectobject ( )
destroy wshshell
ole嵌入浏览器,如何调用其载入网页中的函数
比如网页中有这么个函数:
<script language=javascript>
function showmessage(img_name)
{
alert(img_name);
}
</script>
pb中调用:
ole_1.object.document.parentwindow.showmessage(“吞硬币的小猪”);
不过注意,javascript的函数是区分大小写的,而pb对大小写不敏感:),因此只有网页中函数名称是小写的时候,才能够在pb中调用。
