PlayMMedia Example

InstallShield 2016 ยป InstallScript Language Reference

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

*

* This script plays an AVI file during the setup.

*

* Note: To run this example script, create a project (or

*       insert into project) with several features and/or

*       subfeatures with components containing files.  Then

*       add an AVI file to Disk 1 in the Support Files view in

*       the IDE.  Change the file name in #define SOURCE line

*       below to specify your AVI file.

*

* Warning: Since this example does not include uninstallation

*          functionality, use this example only with projects

*          that do not overwrite important files, install

*          shared files, or update the registry.

*

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

 

#define SOURCE  SRCDIR + "windy7(1).avi"

#define TITLE1  "Playing AVI synchronously..."

#define TITLE2  "Playing AVI asynchronously and continuously..."

 

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

#include "Ifx.h"

 

export prototype ExFn_PlayMMedia(HWND);

 

function ExFn_PlayMMedia(hMSI)

    NUMBER nvDisk;

begin

 

    Enable ( BACKGROUND );

 

    // First, play the AVI synchronously to demonstrate how this causes

    // it to play by itself, with no other events taking place.

    SetTitle (TITLE1, 16, YELLOW);

    PlaceWindow (MMEDIA_AVI, 10, 10, UPPER_RIGHT);

 

    if (PlayMMedia (MMEDIA_AVI, SOURCE, MMEDIA_PLAYSYNCH, 0) < 0) then

        MessageBox ("Unable to play AVI file.", WARNING);

    endif;

 

    // Now play the AVI asynchronously.  The AVI continues executing

    // as the file transfer occurs.

    SetTitle (TITLE2, 16, YELLOW);

    

    PlaceWindow (MMEDIA_AVI, 10, 10, LOWER_RIGHT);

 

    if (PlayMMedia (MMEDIA_AVI, SOURCE,

                    MMEDIA_PLAYASYNCH | MMEDIA_PLAYCONTINUOUS, 0) < 0) then

        MessageBox ("Unable to play AVI file.", WARNING);

    endif;

 

    Enable (STATUSDLG);

    Enable (INDVFILESTATUS);

 

    StatusUpdate (ON, 99);

 

    // Transfer the files.

    ComponentMoveData (MEDIA, nvDisk, 0);

 

    Disable (INDVFILESTATUS);

    Disable (STATUSDLG);

 

    // The AVI will stop playing when the setup exits.  But you can

    // stop it explicitly like this:

    PlayMMedia (MMEDIA_AVI, SOURCE, MMEDIA_STOP, 0);

 

end;