Creator read-only
poperty Returns the Pack1Creator
object for the apartment. All the objects created by using it will be
created in this apartment unless it is not registered in the registry
as free-threaded. If other creation methods are used - especially
those which bypass the registry the object will be created in the
apartment even if its registration is free-threaded.
Syntax:
Set creator = object.Creator
Examples:
Set creator = object.Creator
Set obj = creator.CreateObject("object_ID_class_ID_etc")
Remarks:
When COMApartment object is created it creates internally a thread
and initializes COM in it. Then it creates in the same thread a Pack1Creator
object which can be used further to create other objects in that
thread and apartment.
When the host supplied creation features are used such as
Server.CreateObject or script language's internal functions such as
CreateObject or new ActiveXObject the new object is created in the
script's apartment. Using COMAparmtent object you are able to create
objects in separate apartment and thus isolate them from the script.
The reasons to do this can be different. Some of the most
interesting applications are:
- You want to create object and call one of its methods from a COMThread
object later.
- You want to ensure certain COM object registered as
"both" in the registry will be created in a
single-threaded apartment. For example ALP runs the scripts in a
free-threaded apartment and the external objects created in the
pages will be created in this free-threaded apartment if they are
registered as "both". ShellLink
object for example needs to be created in a single-threaded
apartment if Internet shortcuts will be managed with it.
- You want to create certain "apartment" objects but
without registering them into the registry. Then Windows will not
be able to determine where to put them and will put them in the
same apartment. In ALP case (in pure autorun scenario for example)
this will put them in its free-threaded apartment and they will
probably fail at some point and this may even crash the
application. So in this case you can create an apartment and
create the object through it.
Applies to: COMApartment
object
|