ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Standard functions / Windows functions / Executable functions
  • Using a command line
  • Application in the background: Specific case from Android 10
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Executes a program (an executable file, for example) from the current application.
Example
AndroidAndroid Widget
// Start Google Maps
ExeRun("com.google.android.apps.maps")
Syntax

Running an executable (in locking or non-locking mode) Hide the details

<Result> = ExeRun(<Program name> [, <Mode> [, <Wait for end> [, <Working directory>]]])
<Result>: Boolean
  • True if the program was started,
  • False otherwise. ErrorInfo returns more details about the error.
<Program name>: Character string
Name of program to start with its path and/or the parameters that must be passed to the program (if necessary).
  • If no path is specified, the program is sought in the current directory, then in the Windows directory and in the directories accessible by PATH.
  • If the executable corresponds to a long name with space characters, the following syntax must be used:
    <Program name> = " " " Long_name_with_spaces" " Command_line"
AndroidAndroid Widget Full name of the application to be started (with the package name) with the parameters to be passed to the program, if necessary.
  • Example: to start the Google Maps application, <Program name> corresponds to: "com.google.android.apps.maps".
  • To specify parameters to be passed in command line, simply use the following notation:
    <Program name> = <Package name> <Parameter name 1> = <Parameter value 1>
Starting with Android 11, the package name must be added in the application manifest. You can find an example at FAQ below: How to allow another application to be launched with ExeRun from an application in Android 11?
<Mode>: Optional integer constant
Program start mode (no action on DOS programs):
exeActive
(Default value)
The program run is active, it "takes control" over the current program.
exeIconizeThe program run is inactive and it is minimized.
AndroidAndroid Widget This constant is not available.
exeInactiveThe program run is inactive: it is run while the current program keeps focus.
AndroidAndroid Widget This constant is not available.
exeMaximizeThe program run is active, it "takes control" over the current program (the execution window is maximized).
AndroidAndroid Widget This constant is not available.
exeNoHandleInheritanceIndicates that the executable should not inherit handles from the parent (applies to ALL handles, including files). The executable is independent of the application that launched it.
This constant can be combined with other application launch constants.
AndroidAndroid Widget This constant is not available.
AndroidAndroid Widget The program run is always active: it is run by "taking control" over the current program.
<Wait for end>: Optional Boolean constant
Configures the timeout before resuming the execution of the current program:
exeDontWait
(Default value)
The current program and the launched program run in parallel.
exeWaitThe current program resumes its execution when the program run is over.
AndroidAndroid Widget The application can be started in non-locking mode only. A fatal error occurs if the exeWait constant is used.
<Working directory>: Optional character string
Working directory of application to start.
AndroidAndroid Widget This parameter is not available.
Remarks

Using a command line

To pass parameters in command line to the executable run, you must specify the name and full path of the executable to run.
Android If the program run was developed with WINDEV or WINDEV Mobile, you can get the command line using CommandLine.
AndroidAndroid Widget

Application in the background: Specific case from Android 10

From Android 10, it is no longer possible to open a window when the application is in the background.
ExeRun can open a window. If this function is used while the application is in the background, a fatal error will occur.
Tips:
  • It is possible to determine if the application is in the background using InBackgroundMode.
  • If an application needs to interact with the user while it is in the background, the solution is to display a notification (via the Notification type). The application will be brought back to the foreground when the notification is clicked, if the ActivateApplication property is set to True. You can also open a window from the procedure passed to the ActionClick property.
Component: wd290std.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 10/02/2023

Send a report | Local help