StatusUpdate Example

InstallShield 2019 » InstallScript Language Reference

Note • To call this function in a Basic MSI setup, you must first create a custom action for the entry-point function, execute the custom action in a sequence or as the result of a dialog's control event, and then build the release.

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

*

* InstallShield Example Script

*

* Demonstrates the StatusUpdate function.

*

* This script copies all files from a source directory to a

* target directory.  StatusUpdate is called to set the limit

* of the progress bar and to regulate the progress indicator

* as the files are copied.

*

* Note: Before running this script, create the directories

*       referenced by SOURCE_DIR and TARGET_DIR and create two

*       or more files in SOURCE_DIR.

*

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

 

#define SOURCE_DIR "C:\\ISExampl\\Source"

#define TARGET_DIR "C:\\ISExampl\\Target";

 

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

#include "Ifx.h"

 

export prototype ExFn_StatusUpdate(HWND);

 

function ExFn_StatusUpdate(hMSI)

begin

 

    // Enable the progress bar.

    Enable(STATUS);

    

    // Set the limit of the progress bar to 99% completion.

    StatusUpdate (ON, 99);

    

    // Copy the files.

    if (XCopyFile (SOURCE_DIR ^ "*.*", TARGET_DIR ^ "*.*", COMP_NORMAL) < 0 ) then

        MessageBox ("An error occurred while copying files.",SEVERE);

    endif;

    

    // Display a message; do not change the progress bar.

    SetStatusWindow (-1, "File Copying completed at 99%.");

    Delay (3);

    

    // Set the progress bar to 100% and displays a message.

    SetStatusWindow (100, "StatusUpdate example completed, now exiting...");

    Delay (3);

 

end;