version 6.8.2
AP ShellExecute (fileName{; mode{; param}}) Longint
| Parameter | Type | Description | |
| fileName | String | Name of file or document to be launched | |
| mode | Longint | Status of window at time of launch (Windows) | |
| Synchronous mode (Mac OS) | |||
| param | Text | Application parameters (Windows) | |
| Function result | Longint | 0, if the command execution succeeded; | |
| otherwise, a system error |
Description
The AP ShellExecute command enables you to launch an application or open a document from a 4D database.
Note: This command is similar to the existing AP Sublaunch command; however, its operation has been optimized under Windows, in particular via the use of the 3rd parameter.
Under Windows
In the fileName parameter, pass the name or complete (absolute) access path of the file to be launched. When the application or document to be opened is located next to the database structure, it is possible to pass only the file name or a relative access path.
Simply indicate a document name and Windows handles the execution of the associated application.
The mode parameter enables you to specify the display mode of the window in which the application will be launched:
if you pass 0, the window will be normal;
if you pass 1, the window will be full-screen;
if you pass 2, the window will be reduced and will appear in the Windows task bar.
The param parameter enables you to pass any additional type of parameter that may be necessary for the launched application. For instance, if you use this command to launch a Web browser, you can pass a specific URL in this parameter.
Note: The param parameter is only used under Windows. It is ignored under Mac OS.
Under Mac OS
In the fileName parameter, pass the name or complete (absolute) access path of the file to be launched. When the application or document to be opened is located next to the database structure, it is possible to pass only the file name or a relative access path.
Simply indicate a document name and Mac OS handles the execution of the associated application.
The mode parameter enables you to specify synchronous (if you pass 1) or asynchronous (if you pass 0) opening of the application or document.
Examples
1. This example opens a Word® document located at the root of the main disk:
`Under Windows
$err:=AP ShellExecute ("C:\Test.doc")
`Under Mac OS
$err:=AP ShellExecute ("HardDisk:Test.doc")
2. This example launches an internet browser, in full-screen mode by default, on the 4D site:
$err:=AP ShellExecute ("www.4d.fr";"1")
3. This example (Windows) opens the 4D site in full-screen on Netscape® whatever the default internet browser:
$err:=AP ShellExecute ("C:\Program Files\Netscape\NETSCAPE.EXE";"1";"www.4d.fr")
4. This example opens the Windows Explorer in a normal window and displays the contents of the Music folder:
$err:=AP ShellExecute ("C:\WINDOWS\explorer.exe";0;"C:\Music")
See Also