Passing a String Array Between an Object and an Installation

InstallShield 2015

To pass a string array between an object and an installation:

• Add the following to the object script:
• A declaration of a read-write property whose data type is variant. For example:

property(get,put) variant Test();

 

Place this declaration in the Properties Section block of the object script.

• Declarations of the necessary variables, including a variable to store the property’s value within the object script:

STRING arrayTest();

variant m_arrayTest;

Place these declarations in the Local Variables Section block of the object script.

• Statements, in the InitProperties function block, that initialize the members of the variable that stores the property’s value. For example:

m_arrayTest = arrayTest;

 

• A function call, in the ReadProperties function block, to retrieve the value stored in the property bag object. For example:

ReadArrayProperty(PropertyBag, "Test", m_arrayTest);

 

• A function call, in the WriteProperties function block, to save the value to the property bag object. For example:

WriteArrayProperty(PropertyBag, "Test", m_arrayTest);

 

• A function block defining the property’s get procedure—that is, defining the actions that are executed when the property’s value is read by a project containing the object or by the object’s design-time wizard (if any). For example:

function variant get_Test()

begin

return m_arrayTest;

end;

• A function block defining the property’s put procedure—that is, defining the actions that are executed when the property’s value is written to by a project containing the object or by the object’s design-time wizard (if any). For example:

function void put_Test(newVal)

begin

m_arrayTest = newVal;

end;

• Add the following to the installation script:
• In each function block in which you will read a string array from or write it to the object, declarations of an object variable and a string array. For example:

OBJECT oObject;

string szTest(3);

• A call to GetObject to get a reference to the object. For example:

set oObject = GetObject("Object");

if (!IsObject(oObject)) then

    MessageBox( "Failed to get object reference.", INFORMATION );

    abort;

endif;

• To set the value of the object’s string array property, use code like the following:

oObject.Test = szTest;

 

To retrieve the value of the object’s string array property, use code like the following:

szTest = oObject.Test;