The Shell function runs an application that is linked to the file specified in Path. If the function was successfully performed it returns the process ID of the started application.
Syntax | |||||
Shell(Path [, Parameter] [, Directory] [, Verb] [, WindowStyle] [, Wait]) | |||||
Return value | |||||
Type |
Description | ||||
Long |
Process ID of the started program | ||||
Parameter | |||||
Use |
Name |
Type |
Passing |
Description | |
Required |
Path |
String |
ByVal |
Path to the executable file | |
Optional |
Parameter |
String |
ByVal |
Command line parameters of the application | |
Optional |
Directory |
String |
ByVal |
The working directory of the application to be started | |
Optional |
Verb |
String |
ByVal |
The embodiment of the application to be launched. If not specified, verb contains the value "open" | |
Optional |
WindowStyle |
Long |
ByVal |
Display of the 1st window of the application to be started | |
Optional |
Wait |
Boolean |
ByVal |
Waiting for the program to finish; Default is False | |
If the Shell function successfully executes the specified file, it returns the process ID of the started program. The Process ID is a number that uniquely identifies the program that is running. If the Shell function cannot start the specified program an error occurs and zero is returned.
Use the Path parameter to pass only the name of the program to be executed.
Parameter (optional) can specify all required arguments or command line options.
The optional Directory parameter determines the working directory under which the application is running.
The optional Verb parameter determines the type of operation:
Verb |
Description |
Open |
The file opens with the linked application. The specified file in the path parameter can also be an Exe. |
|
The file in the Path parameter is printed with the linked application. |
Runas |
The file opens with the linked application. The specified file in the Path parameter can also be an Exe. The file opens in administrator mode. |
The optional WindowStyle parameter specifies the style of the window in which the program is to be run. If WindowStyle is not specified, the program receives focus and starts in a minimized state.
The following values can be passed for WindowStyle:
ShellWindowStyles |
Description |
0 – SWSHide |
The first application window is hidden. |
1 – SWSShowNormal |
The first application window is displayed normally and receives the focus |
2 – SWSShowMinimized |
The first application window is displayed minimized and receives the focus. |
3 – SWSShowMaximized |
The first application window is displayed maximized. The window receives the focus. |
4 – SWSShowBest |
The first application window appears and receives the Focus. Shell tries to display the window in the best possible shape. |
7 - SWSShowMinNotActivated |
The first window is displayed minimized and not activated |
8 – SWSShowNotActivated |
The first window appears normally but is not activated |
The optional wait parameter specifies whether TCE should wait for additional code to run until the started process is finished again.