Introduction MTB Statements File System Compiler Applications Reference Guide Index

Language Structure Data Division I/O Format Division Procedure Division Mnemonics

(ShellExecute)

Mnemonic: (ShellExecute=Action$, File$, Args$, WorkDir$,WinMode)
Discussion: This mnemonic is used with the system driver (X00), and is used to launch a Windows program.

The parameters are:

Action$ = A verb associated with the file type. Typically "open" or "play". To specify the default action, use "". You can see the verbs for a given file type from the File Types dialog available via the "View/Folder Options" menu item (in Windows Explorer).

Prog$ = The name of a program (e.g., notepad.exe) or a document (e.g., myfile.txt)

Args$ = Additional command line arguments

WorkDir$ = The current directory to use when executing the Prog$

WinMode =

0 - Hides the window and activates another window.
1 - Activates and displays a window. If the window is 
    minimized or maximized, Windows restores it to its 
    original size and position. An application should 
    specify this flag when displaying the window for the 
    first time.
2 - Activates the window and displays it as a minimized window.
3 - Activates the window and displays it as a maximized window.
4 - Displays a window in its most recent size and position. The
    active window remains active.
5 - Activates the window and displays it in its current 
    size and position.
6 - Minimizes the specified window and activates the next 
    top-level window in the Z order.
7 - Displays the window as a minimized window. The active
    window remains active.
8 - Displays the window in its current state. The active window
    remains active.
9 - Activates and displays the window. If the window is
    minimized or maximized, Windows restores it to its original
    size and position. An application should specify this flag
    when restoring a minimized window.
10 - Sets the show state based on the SW_ flag specified in the
     STARTUPINFO structure passed to the CreateProcess function
     by the program that started the application.
History: This mnemonic was added in REL 00.06.
Example 1: The following code launches the NOTEPAD program. The system driver (X00) is opened on Logical Unit Number 20.
OPEN (20) "X00"
PRINT (20) (ShellExecute="open","notepad.exe","","",1)
CLOSE (20)
where:
  • Parameter 1 (open) is the action associated with an EXE file
  • Parameter 2 (notepad.exe) is the program name
  • Parameters 3 and 4 are not needed in this case (thus the "")
  • Parameter 5 (1) activates and displays a window