FeatureSetupTypeSet Example

InstallShield 2015 ยป InstallScript Language Reference

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

*

* InstallShield Example Script

*

* Demonstrates the FeatureSetupTypeSet function.

*

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

*       insert into a project) with several setup types and

*       features. Make sure you specify the setup types'

*       default feature selections.  If you do not include

*       a Compact setup type, then define one of your setup

*       types as SETUP_TYPE in the #define SETUP_TYPE line

*       below.

*

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

 

#define SETUP_TYPE   "Compact"

#define SDSETUPTITLE "Setup Type Selection"

#define SDSETUPMSG   "Select a setup type other than " + SETUP_TYPE + "."

#define SDFEATTITLE  "Feature Selection"

#define SDFEATMSG1   "Feature selection before FeatureSetupTypeSet."

#define SDFEATMSG2   "Feature selection after FeatureSetupTypeSet."

#define MSG1         "FeatureSetupTypeSet will now select all\n"

#define MSG2         "features in the " + SETUP_TYPE + " setup type."

 

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

#include "Ifx.h"

 

export prototype ExFn_FeatureSetupTypeSet(HWND);

 

function ExFn_FeatureSetupTypeSet(hMSI)

    STRING szSetupType, svSetup, svDir;

begin

 

   // Disable the Back button in setup dialogs.

   Disable (BACKBUTTON);

 

   // Select a setup type other than SETUP_TYPE to show default

   // selection settings.

   SdSetupTypeEx (SDSETUPTITLE, SDSETUPMSG, "", svSetup, 0);

 

   // Display the feature selections for the selected setup type.

   svDir = INSTALLDIR;

   SdFeatureMult (SDFEATTITLE, SDFEATMSG1, svDir, "");

 

   MessageBox (MSG1 + MSG2, INFORMATION);

 

   // Now change/override the previous setup type selection by

   // selecting SETUP_TYPE's features. All others are deselected.

   szSetupType = SETUP_TYPE;

   if (FeatureSetupTypeSet (MEDIA, szSetupType) < 0) then

       MessageBox ("FeatureSetupTypeSet failed.", SEVERE);

   endif;

 

   // Display the new feature selections.

   SdFeatureMult (SDFEATTITLE, SDFEATMSG2, svDir, "");

 

end;