FeatureSetData Example

InstallShield 2014 ยป InstallScript Language Reference



* InstallShield Example Script


* Demonstrates the FeatureSetData function.


* This example script demonstrates a function that sets data

* and properties for a specified feature.


*  Comments:  To run this example script, create a project (or

*             insert into a project) with several features and/or

*    subfeatures with components containing files.




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

#include "Ifx.h"


// Include iswi.h for Windows Installer API function prototypes and constants,

// and to declare code for the OnBegin and OnEnd events.

#include "iswi.h"


// The keyword export identifies MyFunction() as an entry-point function.

// The argument it accepts must be a handle to the Installer database.

   export prototype MyFunction(HWND);


// To Do:  Declare global variables, define constants, and prototype user-

//         defined and DLL functions here.


function MyFunction(hMSI)


    STRING  svDir, szTitle, szMsg, szData;

    NUMBER  nData;




    svDir   = INSTALLDIR;

    szTitle = "Select Features";

    szMsg   = "Select the features you want to install on your computer.";

    szData  = "Required Feature";


    // Hide Feature1 from the end user.

    FeatureSetData (MEDIA, "Feature1", FEATURE_FIELD_VISIBLE, FALSE, szData);


    // Set the display name for Feature2.

    FeatureSetData (MEDIA, "Feature2", FEATURE_FIELD_DISPLAYNAME, nData, szData);


    // Display available features.

    SdFeatureTree (szTitle, szMsg, svDir, "", 2);