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

*

* This script calls Do to test the HELP and EXIT handler.

*

* Note: Before running this script, set the preprocessor

*       constant so that it references a valid

*       help file on the target system.

*

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

 

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

#include "Ifx.h"

 

#define HELPFILE WINDIR^"Help\\Windows.chm"

 

    export prototype ExFn_Do(HWND);

 

function ExFn_Do(hMSI)

begin

 

    // Install the exit handler.

    HandlerEx (EXIT, Exit_Handler);

 

    // Install the help handler.

    HandlerEx (HELP, Help_Handler);

 

    // Execute loop forever -- or until user aborts.

    while (TRUE)

        if (AskYesNo ("View the help?", NO) = YES) then

            // Execute the help handler.

            Do (HELP);

        endif;

 

        // Execute the exit handler.

        Do (EXIT);

    endwhile;

 

// The exit handler.

Exit_Handler:

 

    // Ask for confirmation to abort.

    if (AskYesNo ("Do you really want to exit?", NO) = YES) then

        abort;

    else

        // Continue if not sure.

        return;

    endif;

 

// The help handler.

Help_Handler:

 

    // Display the help.

    LaunchApplication (HELPFILE, "", "", SW_SHOW, INFINITE, LAAW_OPTION_WAIT);

    return;

 

end;