Vcl.OleAuto.CreateOleObject

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function CreateOleObject(const ClassName: string): Variant;

C++

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

Properties

Type Visibility Source Unit Parent
function public
Vcl.OleAuto.pas
Vcl.OleAuto.hpp
Vcl.OleAuto Vcl.OleAuto

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 the 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 instances of the same class, we recommend that you use a class factory.

Tip: As shown in the example, you can release the interface stored in the returned Variant by assigning the Unassigned constant to that Variant.

See Also