GetProfInt Example

InstallShield 2016 » InstallScript Language Reference

Note • To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release.

/*--------------------------------------------------------------*\

*

* InstallShield Example Script

*

* Demonstrates the GetProfInt function.

*

* GetProfInt is called to retrieve the value of a key in

* the file specified by EXAMPLE_INI.

*

* Note: Before running this script, create a file called

*       ISExample.ini in the root of drive C.  Include the

*       following lines in that file.

*

*       [ISExample]

*       ISKey=100

*

\*--------------------------------------------------------------*/

 

#define  EXAMPLE_INI  "C:\\ISExampl.ini"

 

// Include Ifx.h for built-in InstallScript function prototypes.

#include "Ifx.h"

 

export prototype ExFn_GetProfInt(HWND);

 

function ExFn_GetProfInt(hMSI)

    STRING szSectionName, szKeyName;

    NUMBER nvValue;

begin

 

    szSectionName = "ISExample";

    szKeyName     = "ISKey";

    

    // Get the value of szKeyName under the szSectionName section.

    GetProfInt (EXAMPLE_INI, szSectionName, szKeyName, nvValue);

    

    SprintfBox (INFORMATION, "GetProfInt Example",

               "The value of %s is: %d.", szKeyName, nvValue);

 

end;