IOleDocumentBox.CreateObject

Syntax

CreateObject(ClassName: String);

Parameters

ClassName. Program identifier of the created COM object.

Description

The CreateObject method creates an instance of the specified COM object and places it to the component.

Comments

An application program identifier specified in the ClassName parameter can be obtained from the operating system registry: find the global unique identifier of the created COM object in the HKEY_CLASSES_ROOT\CLSID section. The name of COM object is the default value for the section of the global unique identifier. The found section contains the ProgID subsection, which default value is the program identifier of the application.

The CreateObject method is applied only for windowless COM objects.

NOTE. On dynamic creation of the OleDocumentBox component, the CreateObject method can be used only after the Parent property is set for the component.

Example

Executing the example requires that the repository contains a form with the Button component named Button1, and the OleDocumentBox component named OleDocumentBox1.

The example is a handler of the OnClick event for the component named Button1.

Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
Begin
    OleDocumentBox1.CreateObject(
"Excel.Sheet");
End Sub Button1OnClick;

After executing the example, clicking the button in the component named OleDocumentBox1 creates and loads a Microsoft Excel spreadsheet.

See also:

IOleDocumentBox