Show: Delphi C++
Display Preferences

System.Win.ComObj.CreateOleObject

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function CreateOleObject(const ClassName: string): IDispatch;

C++

extern DELPHI_PACKAGE _di_IDispatch __fastcall CreateOleObject(const System::UnicodeString ClassName);

Properties

Type Visibility Source Unit Parent
function public
System.Win.ComObj.pas
System.Win.ComObj.hpp
System.Win.ComObj System.Win.ComObj

Description

Instantiates an Automation object.

CreateOleObject creates a single uninitialized object of the class specified by the ClassName parameter. ClassName specifies the string representation of the Class ID (CLSID). CreateOleObject 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. Only objects that are not part of an aggregate are created using CreateOleObject.

Note: In Delphi code, CreateOleObject is called once to create each new single instance of a class. To create multiple instance of the same class, using a class factory is recommended.

CreateOleObject returns a reference to the interface that can be used to communicate with the object. For CreateOleObject this interface is of type IDispatch. To create a COM object that does not support an IDispatch interface, use CreateComObject.

Tip: As shown in the example, if the interface returned by CreateOleObject is assigned to a Variant, you can release the interface by assigning the Unassigned constant to that Variant.

See Also

Personal tools
Translations