$ObjCreate
$ObjCreate
Creates the named ActiveX object.
Syntax
$ObjCreate (ProgId)
Parameters
ProgId | a string or an expression that evaluates to a string |
Return Value
Returns an object that can be assigned to a variable of type object.
Comments
An ActiveX or COM object is identified by a GUID (a globally unique number). A ProgId identifies a COM object with a meaningful name. It looks like vendor.component.version or vendor.component.
When you assign to an Object variable using $ObjCreate, the existing COM object referenced by the Object variable (if any) is released.
Before your program terminates, it’s a good idea to set any Object variables to $Null, so that the objects your program used can be released. Otherwise, even after your program terminates, because the Zim variables still exist and still reference the COM objects you used, the objects will still be active and consuming memory and resources.
This does not apply to the OLE control form variable, since when the form is closed the OLE control is automatically released, but it does apply to any objects returned from an OLE control via $ ObjRunMethod or $ ObjGetProperty.
See Also