APGen Documentation Previous Topic: APGScript.Abort() Next Topic: APGScript.ConnectEvents() Parent Topic: APGScript Object    APGScript Object
APGScript.CreateObject()
See Also:

The CreateObject() method creates a COM object, and optionally activates script handling of its events.

Syntax

VBScript:

Set oObject = oAPGScript.CreateObject( strProgID, [strHandlerPrefix] )

JScript:

oObject = oAPGScript.CreateObject( strProgID, [strHandlerPrefix] );

Object

oAPGScript An APGScript object.

Parameters

strProgID The PROGID of the component being created.
strHandlerPrefix Optional. Call script functions named strHandlerPrefix + EventName when this object fires events.

Return Value

oObject The created COM object.

Notes

Provides external access to Script.CreateObject().  See the Script.CreateObject() topic for more information.

If the parameter strHandlerPrefix is specified, APGen connects to the object's default outgoing interface after creating the object.  When the object fires an event, APGen calls a script subroutine (inside oAPGScript ) named strHandlerPrefix plus the event name.  Note that APGScript.CreateObject() hooks up event handler procedures inside the oAPGScript script code to events raised by oObject.  If oAPGScript has not yet been run, none of the procedures within the script are available, so they will not be called when oObject fires events.

If strHandlerPrefix is used, use APGScript.DisconnectEvents() to disable script event handling for the object.

Applies To

APGScript Object