FeatureIsItemSelected Example

InstallShield 2014 ยป InstallScript Language Reference

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

*

* InstallShield Example Script

*

* Demonstrates the FeatureIsItemSelected function.

*

* This example script displays a dialog that displays a list

* of features in the setup that the user can install and the

* amount of space that each feature occupies. When the user

* selects features, the installed state of the features is

* provided.

*

*  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  szTitle, szMsg, svDir;

    NUMBER  nResult;

  

begin

 

    svDir   = INSTALLDIR;

    szTitle = "Select Features";

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

    

    // Display available features.  

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

    

    // Determine the installed state of Subfeature1.

    nResult = FeatureIsItemSelected (MEDIA,  "Feature1\\Subfeature1");

    

    // Display message indicating the installed state of Subfeature1.

    if nResult = 1  then

     MessageBox ("Subfeature1 is installed locally.", INFORMATION);

    else

     MessageBox ("Subfeature1 is uninstalled.", INFORMATION);

    endif;            

  

end;