DoInstall 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 DoInstall function.

*

* This example script runs the MessageBox example script

* using the DoInstall function.

*

* Note: To make this example work correctly you must also do

*       the following:

*

*       1.   Create a second setup project.  This setup will be

*            launched by the DoInstall function. This project

*            should include an up-to-date built release.

*

*       2.   Create a new folder named 'Second' in the disk1

*            folder of this setup.

*

*       3.   Copy the disk# folder(s) from the second setup

*            into the newly created 'Second' folder.

*

*      The second setup should then be launched successfully.

*

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

 

#define SECOND_INSTALL_PATH SRCDIR ^ "Second\\Disk1"

#define SECOND_INSTALL_FILENAME "Setup.exe"

 

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

#include "Ifx.h"

 

export prototype ExFn_DoInstall(HWND);

 

function ExFn_DoInstall(hMSI)

    NUMBER nReturn;

    STRING szTemp;

begin

 

    MessageBox ("About to launch the second setup.", INFORMATION);

 

    // Launch the second setup.

    nReturn = DoInstall (SECOND_INSTALL_PATH ^ SECOND_INSTALL_FILENAME, "",

                        LAAW_OPTION_WAIT);

 

    if ( nReturn = 0) then

        // Report successful second setup launch.

        MessageBox("The second setup was launched successfully.", INFORMATION);

    else

        // Report failure to launch second setup.

        SprintfBox(SEVERE, "", "DoInstall failed with a return code of %d.", nReturn);

    endif;

 

end;