RunShell

An advanced form of the Run function that even allows the specification of a working directory, along with the window view mode and whether or not to wait for completion of the run program in a single function. See Also: ShellExecute

Syntax:

RunShell(program-name, params, directory, display mode, waitflag)

Parameters:

(s) program-name: the name of the desired .EXE, .COM, .PIF, .BAT, .CMD file or a data file.

(s) params: optional parameters as required by the application.

(s) directory: target directory (if applicable).

(i) display mode: @NORMAL, @ICON, @ZOOMED, @HIDDEN, @NOACTIVATE or 0 for the default mode.

(i) waitflag: @WAIT, @NOWAIT, @GETPROCID, @GETEXITCODE.

Returns:

(i) @TRUE if the program was found.; @FALSE if it wasn't.

 

If a data file is specified instead of an executable file (i.e. EXE, COM, PIF, BAT or CMD file), the function examines the extension of the data file, looks the extension up in the Windows registry to determine the owning application and starts the owning application, passing the data file name as a parameter. Applications that support this command or their setup programs will generally make the necessary modifications to the Windows registry to allow this function to perform successfully.

If the drive and path are not part of the program name, the current directory will be examined first, followed by the Windows and Windows System directories, and then the DOS path will be searched to find the desired executable file.

The @NOACTIVATE value causes the targeted application's window to be displayed in its most recent size and position but without making the application's window the active window when another top-level window is already active.

If the @WAIT parameter is used, the WIL program will suspend processing until the application is closed.

If the @GETPROCID parameter is used, a process-id will be returned that can be used with the function WinItemProcID.

If the @GETEXITCODE parameter is used, the exit code of an application that is launched with the RunShell function will be returned. This is the same as specifying @WAIT, except that on success the function will return the exit code of the application that was launched.

Note: When this command launches an application, it merely informs it how you wish it to appear on the screen. Whether or not the application honors your wish is beyond this function's control.

 

Example:


RunShell("NOTEPAD.EXE", "CONFIG.SYS", "C:\", @NORMAL, @NOWAIT)

See Also:

IntControl 64, WinItemProcID, Print, Run, RunWait, RunWithLogon, ShellExecute