EzConfigSetValue Example

InstallShield 2024 » 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 EzConfigSetValue function.

*

* EzConfigSetValue is called to add or change the BUFFER and

* FILES commands in the default configuration file.

*

* Note: The first time you run this script, it will create a

*       file named ISExampl.sys in the root of drive C.  You

*       may delete that file when you have finished analyzing

*       this script.

*

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

 

#define EXAMPLE_SYS "C:\\ISExampl.sys"

 

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

#include "Ifx.h"

 

export prototype ExFn_EzConfigSetValue(HWND);

 

function ExFn_EzConfigSetValue(hMSI)

    STRING szRefKey, szMsg;

    NUMBER nValue;

begin

 

    // Set the default configuration file.

    ConfigSetFileName (EXAMPLE_SYS);

    

    // Add or change the BUFFERS command.

    if (EzConfigSetValue ("BUFFERS", 30) < 0) then

        MessageBox ("Unable to set Buffers in " + EXAMPLE_SYS + ".", SEVERE);

    else

        MessageBox ("Buffers set to 30 in " + EXAMPLE_SYS+".", INFORMATION);

    endif;

    

    // Add or change the FILES command.

    if (EzConfigSetValue ("FILES", 30) < 0) then

        MessageBox ("Unable to set Files in " + EXAMPLE_SYS + ".", SEVERE);

    else

        MessageBox ("Files set to 30 in " + EXAMPLE_SYS + ".", INFORMATION);

    endif;

 

end;