CreateObject Method
Creates a COM object.
object.CreateObject(strProgID[,strPrefix])
Objects created with the CreateObject method using the strPrefix argument are connected objects. These are useful when you want to sync an object's events. The object's outgoing interface is connected to the script file after the object is created. Event functions are a combination of this prefix and the event name. If you create an object and do not supply the strPrefix argument, you can still sync events on the object by using the ConnectObject method. When the object fires an event, WSH calls a subroutine with strPrefix attached to the beginning of the event name. For example, if strPrefix is MYOBJ and the object fires an event named OnBegin, Windows Script Host calls the MYOBJ_OnBegin subroutine located in the script. The CreateObject method returns a pointer to the object's IDispatch interface.
Tip:
|
|---|
|
The Script Center Repository includes examples that use the CreateObject method that have been contributed by members of the community. In the Script Center Repository search box, type CreateObject. |
Tip: