GetObject

InstallShield 2024 » InstallScript Language Reference

The GetObject function initializes the szObjectName object and returns a reference that can be assigned to a variable of type OBJECT by using the set keyword. To get a reference to a new or existing COM object (as Visual Basic's GetObject function does), call CoGetObject.

Tip:To check whether the object was initialized successfully, call the IsObject function.

Syntax

GetObject ( szObjectName );

Parameters

GetObject Parameters

Parameter

Description

szObjectName

Specifies the name of the InstallShield object to be initialized as that name is displayed in the Features view, for example:

"New ATL 3.0"

Note:To ensure that the correct InstallShield object is initialized, give each InstallShield object in your project a unique name.

If szObjectName is set to a null string (""), in an object project GetObject returns a reference to the object that is calling it (in a setup project GetObject returns an invalid reference).

Setting szObjectName to a null string is useful for reading and writing object properties within the object itself. For example, the following code displays the current status description for the object:

OBJECT oThis;

 

set oThis = GetObject("");

if( IsObject( oThis ) ) then

    MessageBox( oThis.Status.Description, INFORMATION );

endif;

Return Values

A reference that can be assigned to a variable of type OBJECT by using the set keyword.

See Also