FeatureTotalSize Example
InstallShield 2022 ยป InstallScript Language Reference
/*--------------------------------------------------------------*\
*
* InstallShield Example Script
*
* Demonstrates the FeatureListItems, SdFeatureMult, and
* FeatureTotalSize functions.
*
* Comments: To run this example script, create a project with
* the following features (f), subfeatures (sf),
* and components (c):
*
* (f) Program_Files
* (c) Program_DLLS
* (c) Program_EXEs
* (f) Example_Files
* (sf) Small_Documents
* (c) Small_Document_Examples
* (sf) Books
* (c) Book_Examples
* (sf) Graphics
* (c) Graphic_Examples
* (f) Help_Files
* (c) Help_Files
* (f) Utilities
* (sf) Grammar_Checker
* (c) Grammar_Checker
* (sf) Art_Studio
* (c) Art_Studio
*
\*--------------------------------------------------------------*/
#define FEAT_SELECT_TITLE "Select Features"
#define FEAT_SELECT_MSG "Select features and subfeatures to install."
#define FEATTOTSIZEMSG1 "Want to change feature selections and see\n"
#define FEATTOTSIZEMSG2 "size change reflected in FeatureTotalSize call?"
// Global variable declarations.
// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"
export prototype ExFn_FeatureTotalSize(HWND);
function ExFn_FeatureTotalSize(hMSI)
STRING szDir, svString;
NUMBER nResult, nDone;
LIST listCompList, listTemp;
begin
// Disable the Back button in setup dialogs.
Disable (BACKBUTTON);
// Create a string list of all top-level features.
listCompList = ListCreate (STRINGLIST);
FeatureListItems (MEDIA, "", listCompList);
// Display the string list of top-level features.
SdShowInfoList ("List MEDIA Features", "MEDIA contains " +
"the following top-level features:", listCompList);
// Get each top-level feature in listCompList, in turn, and
// list and display all of its subfeatures, if any.
nResult = ListGetFirstString ( listCompList, svString );
while ( nResult != END_OF_LIST )
listTemp = ListCreate (STRINGLIST);
FeatureListItems (MEDIA, svString, listTemp);
SdShowInfoList ("Subfeature Listing", svString + " contains " +
"the following subfeatures:", listTemp);
ListDestroy (listTemp);
nResult = ListGetNextString (listCompList, svString);
endwhile;
// Show feature selection dialog and total size of all selected
// features. Loop to change selections and see total size change
// reflected in the call to FeatureTotalSize.
nDone = YES;
while (nDone = YES)
szDir = INSTALLDIR;
SdFeatureMult (FEAT_SELECT_TITLE, FEAT_SELECT_MSG, szDir, "" );
nResult = FeatureTotalSize(MEDIA, "", TRUE, TRUE);
SprintfBox (INFORMATION, "", "Total size of all files " +
"in SELECTED features:\n\n%ld", nResult);
nDone = AskYesNo (FEATTOTSIZEMSG1 + FEATTOTSIZEMSG2, YES);
endwhile;
ListDestroy (listCompList);
end;