Embedding Custom Transfer File Operations

InstallShield 2022

In InstallShield, you can embed additional file transfer operations during the standard file transfer of the installation. Also, the progress bar is updated smoothly and appropriately during these operations. There are a few different common scenarios in which you would use this functionality.

This table provides an overview of what functions are called for each scenario.

Determining Which Functions Are Appropriate for Common Custom Transfer File Operations

Scenario Using

Function that Should Be Called

FeatureMoveData

None

XCopyFile or CopyFile

FeatureAddCost

LaunchApplication (external applications)

FeatureAddCost, FeatureSpendCost, FeatureAddUninstallCost, or FeatureSpendUninstallCost

These procedures include step-by-step information about how to use custom file transfer operations for each scenario.

To install additional files during the standard file transfer operation using XCopyFile or CopyFile:

1. Before file transfer, determine the size of the files to be installed, taking into account the cluster size on the target folder for the files. You can accomplish this using the GetAndAddFileCost, CalculateAndAddFileCost, and/or GetAndAddAllFilesCost functions.
2. Using the FeatureAddCost function, add the cost determined in Step 1 to the cost for the feature that these files are associated with. Note that all cost must be associated with a particular feature. Therefore, if the files to be installed are not associated with an existing feature, you must create a sample feature or use an existing feature.
3. During file transfer, call the XCopyFile function to install the files. Typically, this would be done during the Installing event of the feature associated with the additional files or in the OnMoving or OnMoved events. The progress bar is updated smoothly and appropriately during the call. Note that you should disable the Cancel button in the status dialog during the XCopyFile operation. See the description for the XCopyFile function for more information.

Note:There is no additional action required for the uninstallation. The files are uninstalled while the uninstallation progress is updated appropriately.

To call an external installation that installs additional files during the standard file transfer operation:

1. Before file transfer, determine the size and number of the files to be installed (or other operations) by the external installation by examining the external installation and taking note of what operations occur.
2. Using the FeatureAddCost function, add the cost determined in Step 1 to the cost for the feature that this installation is associated with. Note that all cost must be associated with a particular feature. Therefore, if the files to be installed are not associated with an existing feature, you must create a sample feature or use an existing feature. Review the two scenarios below.
3. If the external installation is called during uninstallation, add the number of operations and size of the operations to the uninstallation cost using FeatureAddUninstallCost.
4. During file transfer, use the LaunchApplication event to launch the installation, typically in silent mode. Typically, this would be done during the Installing event of the feature associated with the additional files or in the OnMoving or OnMoved events. Use the LAAW_USE_CALLBACK option so that your script regains control periodically during the installation and uninstallation.
5. Override the OnLaunchAppAndWaitCallback event, and add code to poll the running installation to determine its progress. Then call the FeatureSpendCost (Installation) function or the FeatureSpendUninstallCost (Uninstallation) function to spend the appropriate amount of cost that the installation has completed. Repeat this process while the external installation is running. The progress bar is updated smoothly and appropriately during the call. Note that you might have to adjust the LAAW_PARAMETERS.nCallbackInterval so that the OnLaunchAppAndWaitCallback event is called often enough to keep the progress updated smoothly.

See Also