FeatureGetItemSize Example

InstallShield 2014 ยป InstallScript Language Reference

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

*

* InstallShield Example Script

*

* Demonstrates the FeatureGetItemSize function.

*

* This example calls FeatureGetItemSize to get the size of

* a feature and a subfeature. The sizes are displayed

* in a dialog.

*

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

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

*         subfeatures with components containing files.

*         You must name one feature and one subfeature as

*         indicated in the #define statements in this example,

*         or change the #define statements to reference your

*         feature names.

*

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

 

#define FEAT_NAME1 "Program Files"

#define FEAT_NAME2 "Example Files\\Graphics"

 

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

#include "Ifx.h"

 

export prototype ExFn_FeatureGetItemSize(HWND);

 

function ExFn_FeatureGetItemSize(hMSI)

    NUMBER nvSize;

    STRING szString;

    LIST listInfo;

begin

 

    // Create a string list to store feature sizes.

    listInfo = ListCreate (STRINGLIST);

 

    // Get the size of FEAT_NAME1.

    FeatureGetItemSize (MEDIA, FEAT_NAME1, nvSize);

 

    // Convert the number to a string.

    NumToStr (szString, nvSize);

 

    // Put the string into the list.

    ListAddString (listInfo, "The size in bytes of " + FEAT_NAME1 +

                  " is:  " + szString, AFTER);

 

    // Get the size of FEAT_NAME2.

    FeatureGetItemSize (MEDIA, FEAT_NAME2, nvSize);

 

    // Convert the number to a string.

    NumToStr (szString, nvSize);

 

    // Put the string into the list.

    ListAddString (listInfo, "The size in bytes of " + FEAT_NAME2 +

                  " is:  " + szString, AFTER);

 

    // Display the list of feature sizes.

    SdShowInfoList ("Results of Calls to FeatureGetItemSize",

                   "The feature sizes are:", listInfo);

 

    // Release the list from memory.

    ListDestroy (listInfo);

 

end;