FeatureAddCost

InstallShield 2014 ยป InstallScript Language Reference

Project: This information applies to InstallScript projects.

The FeatureAddCost function specifies that the feature includes additional installation operations that should be accounted for when updating the progress bar during the installation. Specifically, the FeatureAddCost function adds the value of nCost to the specified feature. This function can be called anytime before calling StatusUpdate, but it should typically be used before displaying a feature dialog so that the dialog shows the intended size for the feature to be installed.

Important: The FeatureAddCost function is supported only for file media. Use FeatureGetData or FeatureSetData to set the size of script-created features.

Note: The information specified in this function is not remembered in subsequent installations. This function should be called each time that the feature is being installed, including during repair or maintenance mode. Also, the setup engine has no way to determine whether the specified cost is for a single file or multiple files. Therefore, it does not attempt to adjust the specified size based on the cluster size of the target drive. Thus, you should use the GetAndAddFileCost, CalculateAndAddFileCost , or GetAndAddAllFilesCost functions to determine the cost of the file, taking into account cluster size, before calling this function.

Syntax

FeatureAddCost ( szMediaSource, szFeature, szTarget, nCostHigh, nCostLow );

Parameters

FeatureAddCost Parameters

Parameter

Description

szMediaSource

The media source, typically MEDIA.

szFeature

Specifies the feature to add this cost to. Note that a specific feature in the media must be specified as installation cost is calculated by feature. Cost cannot be specified for the entire media.

szTarget

Specifies the target directory for the cost specified by nCost. This value is used when determining which volume or drive this cost applies to and when displaying the size required for the feature in the feature dialog. Currently, only a single szTarget variable for custom cost is supported for each feature. If you call this function multiple times for the same feature, szTarget variable should be the same each time. Otherwise, the value specified during the last call is used for the target of all additional cost for the feature.

nCostHigh

Specifies the upper 31 bits of the additional cost to be added to the feature.

nCostLow

Specifies the lower 31 bits of the additional cost to be added to the feature.

Return Values

FeatureAddCost Return Values

Return Value

Description

ISERR_SUCCESS

Indicates that the function successfully added the cost.

< ISERR_SUCCESS

Indicates that the function was unable to add the cost.

See Also