Running Programs from Multimedia Viewer

You can run a Windows program from within a Viewer title using the ExecProgram command. You might find this useful for the following reasons:

If your title describes an application, you can run that application without ever leaving the title.

You can use the title as a way to organize and execute various applications.

You can incorporate applications to augment the information presented.

Once you quit the program, you return to Viewer and can continue normal operations.

ExecProgram runs the specified program much the same as using the Run option from the Windows Program Manager File Menu. The .EXE and other necessary files for the program must either be in the PATH or be in the same directory as the .MVB file for the title.

Usually, the ExecProgram command is started when the user clicks a hot spot. This command has two parts:

A word, phrase, or bitmap reference formatted as double-underline text to serve as the activation point for the command

The ExecProgram command formatted as hidden text

The ExecProgram command has the following syntax:

ExecProgram("program",windowstate)

Program is the filename, enclosed in double quotes, of the program you want to run. Windowstate is a number that specifies how the program window initially appears. Use 0 for normal size, 1 for iconized, and 2 for maximized.

In addition to normal hot spots, you can run ExecProgram from either of the following locations in a title:

From a bitmap hot spot created by the Hotspot Editor. (See Chapter 7, “Advanced Bitmap Techniques,” for more information on coding multiple hot spots.)

From a new Viewer button created with a CreateButton entry in the project file (described later in this chapter).

In the following example, ExecProgram runs the Multimedia Player program (in normal size) whenever a user clicks a USSOUND.BMP bitmap:

!ExecProgram("mplayer.exe", 0)