怎么样在pb中动态创建浏览器的OLE对象?

怎么样在pb中动态创建浏览器的OLE对象?

动态创建浏览器的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中调用。