Command AP ShellExecute

4D Pack

AP ShellExecute

version 11 (Modified)


Compatibility Note: This command is now obsolete; it is kept only for compatibility reasons and will be removed in future versions of the plug-in. It is strongly recommended to use the LAUNCH EXTERNAL PROCESS command of 4D. Note that starting with version 11.0 of 4D, AP ShellExecute only works under Windows.

AP ShellExecute (fileName{; mode{; param}}) Longint

ParameterTypeDescription
fileNameStringName of file or document to be launched
modeLongintStatus of window at time of launch
paramTextApplication parameters

Function resultLongint0, if the command execution succeeded;
otherwise, a system error

Note: This command only functions under Windows. Under Mac OS, it has no effect.

Description

The AP ShellExecute command enables you to launch an application or open a document from a 4D database.

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.

Examples

1. This example opens a Word® document located at the root of the main disk:

      `Under Windows
   $err:=AP ShellExecute ("C:\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 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

LAUNCH EXTERNAL PROCESS.