ComObj.CreateComObject
From RAD Studio VCL Reference
Contents |
Delphi Information
From ComObj.pas
function CreateComObject(const ClassID: TGUID): IInterface;
Unit: ComObj
Type: function
Visibility: public
C++ Information
From ComObj.hpp
System::DelphiInterface<System::IInterface> __fastcall CreateComObject(const _GUID & ClassID);
Unit: ComObj
Type: function
Description
Instantiates a single instance of a COM object.
CreateComObject creates a single uninitialized object of the class associated with the CLSID specified by the ClassID parameter. CreateComObject is used to create an object of a specified type when the CLSID is known, and when the object is on a local or in-proc server.
Note: In Delphi code, CreateComObject is called once to create each new single instance of a class. To create multiple instance of the same class it is recommended to use a class factory.
CreateComObject returns a reference to the interface to be used to communicate with the object. For CreateComObject this interface is of type IUnknown. To create OLE objects that return references to the IDispatch interface, use CreateOleObject.
Tip: If the interface returned by CreateCOMObject is assigned to a Variant, you can release the interface by assigning the Unassigned constant to that Variant.