Ole4D Methods

OCDeclareObj(p_ScriptHost;p_VBSVarName; p_PugInArea)



Binds an Ole object to a VBS variable in a script host.
The VBScript code that is run in script host p_ScriptHost can handle the ole object, just like a normal variable, using p_VBSVarName.
You can use this method also to declare objects from other plug-in areas.

Parameters

Parameter Type   Description
p_ScriptHost String -> Script host name.
p_VBSVarName String -> Vbs variable name to refer to the object.
p_PugInArea Longint -> Plug-in area containing the Ole object.



Remarks
The Ole object added to a script must exist until the script host is destroyed.
When you destroy an ole object all scripts in which it was added(if any) are first destroyed.

Suppose you have an object in associated with the plug-in area O4D.
Following method call sequence:
$i := OCDeclareObj("host1","VBVar1",O4D)
$i := OCDeclareObj("host2","VBVar2",O4D)
$i := OCDestroyObj(O4D)

is equivalent to:
$i := OCDeclareObj("host1","VBVar1",O4D)
$i := OCDeclareObj("host2","VBVar2",O4D)
$i := OCDestroyScriptHost("host1")
$i := OCDestroyScriptHost("host2")
$i := OCDestroyObj(O4D)

Example
$i:=OCCreaFromProgId (Area1;"Shell.Explorer")
$i:=OCSetToolBarRect (Area1;50;0;600;40)
$i:=OCActivate (Area1)
$i:=OCCreaScriptHost ("InternetHost")
$i:=OCDeclareObj ("InternetHost";"Browser1";Area1)
$i:=OCRunScript ("InternetHost";"Browser1.Navigate "+Char(34)+"http://www.clsdatapro.com"+Char(34)+Char(13)).