AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones estándar / Funciones de Windows / Funciones de ejecutables
  • Using a command line
  • Using the exeActive constant
  • Return value of a WINDEV executable
  • Starting an application in WEBDEV server code
  • Starting an application in Windows Vista (and later)
  • Miscellaneous
  • Aplicación en segundo plano: Caso concreto de Android 10
WINDEV
WindowsLinuxJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac Catalyst
Otros
Procedimientos almacenados
Executes a program (an executable file, for example) from the current application.
WINDEVWEBDEV - Código ServidorReportes y ConsultasJavaCódigo de Usuario (UMC)Ajax This allows you to retrieve:
  • the return value of executable with the exeReturnValue constant.
  • the process identifier, also called PID with the exePID constant.
WINDEVWEBDEV - Código Servidor Remarks:
Ejemplo
WINDEVWEBDEV - Código Servidor
// Start Notepad in default mode
ExeRun("NOTEPAD.EXE Readme.txt")
WINDEVWEBDEV - Código Servidor
// Start a program with long name containing space characters
// For example: Word with "My documents" as the working directory

// Solution 1: Use the specific syntax of multiline strings
// (to avoid doubling or tripling the quotes)
IF ExeRun([
	"C:\Program Files\Microsoft Office\Office12\WINWORD.EXE"
	], ...
	exeActive, exeDontWait, SysDir(srMyDocuments)) = False THEN
		Error(ErrorInfo())
END

// Solution 2: Double quotation marks
ExeRun("""C:\Program Files\Microsoft Office\Office12\WINWORD.EXE""", ...
	exeActive, exeDontWait, SysDir(srMyDocuments))
WINDEVWEBDEV - Código Servidor
// Start applications with a file in command line
// Name of application to start
sAppName is string = "C:\Program Files\Adobe\Photoshop 6.0\Photoshp.exe"
// Name of the image to open
sImageName is string = "C:\Users\My Name\Pictures\Buildings\IMGP0993.JPG"

// Equivalent to "Start Run" 
// We must get a character string containing "" such as: 
// "C:\Program Files\Adobe\Photoshop 6.0\Photoshp.exe" 
// "C:\Users\My Name\Pictures\Buildings\IMGP0993.JPG"
IF ExeRun(StringBuild([
"%1" "%2"
], sAppName, sImageName)) = False THEN
	Error(ErrorInfo())
END
AndroidWidget Android
// Start Google Maps
ExeRun("com.google.android.apps.maps")
Sintaxis

Running an executable (in locking or non-locking mode) Ocultar los detalles

<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.
PHP This function returns no result.
<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"
AndroidWidget Android 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 launch the Google Maps application, <Nom du programme> 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.
AndroidWidget Android Java This constant is not available.
exeInactiveThe launched program is inactive: it runs while the current program maintains focus..
AndroidWidget Android Java This constant is not available.
exeMaximizeThe program run is active, it "takes control" over the current program (the execution window is maximized).
AndroidWidget Android Java 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.
AndroidWidget Android Java This constant is not available.
PHP This parameter is not available.
AndroidWidget Android Java The launched program is always active: it runs while "taking 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.
AndroidWidget Android The application can be started in non-locking mode only. A fatal error occurs if the exeWait constant is used.
PHP This parameter is not available.
<Working directory>: Optional character string
Working directory of the application to be started.
AndroidWidget Android PHP This parameter is not available.
WINDEVWEBDEV - Código ServidorReportes y ConsultasWindowsLinuxJavaCódigo de Usuario (UMC)Ajax

Starting a program and retrieving a value Ocultar los detalles

<Result> = ExeRun(<Program name> [, <Mode> [, <Element to return> [, <Working directory>]]])
<Result>: Integer
Sought value:
  • Return value of the executable if <Element to return> corresponds to the exeReturnValue constant.
  • PID of the executable if <Element to return> corresponds to the exePID constant.
ErrorInfo is used to find out whether an error occurred.
<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"
<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
exeInactiveThe launched program is inactive: it runs while the current program maintains focus.
exeMaximizeThe program run is active, it "takes control" over the current program (the execution window is maximized)
Java This parameter is ignored. The program run is active, it "takes control" over the current program.
<Element to return>: Optional constant
Configures the function result:
exePIDThe current program and the launched program run in parallel. <Result> corresponds to the identifier of created process (also called PID) if the executable was successfully run, 0 if an error occurred.
This identifier can be used in some APIs for example.
Java This constant is not available.
exeReturnValueThe current program resumes its execution when the program run is over. <Result> is the return value of the executable.
<Working directory>: Optional character string
Working directory of the application to be started.
Observaciones

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.
WINDEVAndroid If the program run was developed with WINDEV or WINDEV Mobile, you can get the command line using CommandLine.
WINDEVWEBDEV - Código ServidorReportes y ConsultasWindowsLinuxJavaCódigo de Usuario (UMC)Ajax

Using the exeActive constant

If the process where the application is run (with the exeActive constant) runs a code allowing the calling program to regain focus, the called program loses control.
In order for the called program to keep focus, you must avoid:
In addition, the Button control (if there is one) whose associated "Click" event contains a call to ExeRun must not be "Tab Stop" ("Acceder al control con TAB" in the "UI" tab of the control description).
WINDEVWEBDEV - Código ServidorReportes y ConsultasWindowsLinuxJavaCódigo de Usuario (UMC)Ajax

Return value of a WINDEV executable

A WINDEV executable can return a value. Simply:
  1. Create an Integer variable global to the project.
  2. Initialize this variable with the value to return.
  3. Return this variable with the RETURN keyword in the project closing code.
WEBDEV - Código ServidorAjax

Starting an application in WEBDEV server code

ExeRun is run on the server, therefore the started application is run on the server.
By default, the application is only visible in the task manager because it is started from a service that does not interact with the Windows desktop.
In order for the program run to be visible on the server, the option "Allow the service to interact with the desktop" must be checked in the properties of the WEBDEV service.
WINDEVWEBDEV - Código ServidorReportes y ConsultasWindowsCódigo de Usuario (UMC)Ajax

Starting an application in Windows Vista (and later)

If UAC (User Account Control) is enabled, the application that uses ExeRun to start another application must have higher permissions than the application that is started.
For example, a first application started with the administrator rights can start a second application that requires no specific rights.
If the second application requires greater rights than the application that starts it, the second application may fail to start. Windows proposes to enable the management of compatibility with Windows Vista. If the management of compatibility is enabled, the second application will be run during its next startup. You can also use ShellExecute.
WINDEVWEBDEV - Código ServidorReportes y ConsultasWindowsLinuxJavaCódigo de Usuario (UMC)Ajax

Miscellaneous

  • ExeRun does not modify the current directory. The current directory before running ExeRun is identical to the current directory after running ExeRun.
  • If the launched program does not take into account the specified execution mode, the program is launched by default in exeActifmode.
AndroidWidget Android

Aplicación en segundo plano: Caso concreto de Android 10

A partir de Android 10, no se puede abrir una ventana si la aplicación está en segundo plano.
La función ExeRun puede abrir una ventana. Si se utiliza esta función cuando la aplicación está en segundo plano, se producirá un error fatal.
Consejos:
  • Para saber si la aplicación está en segundo plano, utilice la función InBackgroundMode.
  • Si una aplicación necesita interactuar con el usuario cuando está en segundo plano, se puede mostrar una notificación (con el tipo Notification). La aplicación volverá al primer plano cuando se haga clic en la notificación, si la propiedad ActivateApplication se establece en True. También es posible abrir una ventana desde el procedimiento pasado a la propiedad ActionClick.
Para obtener más información, consulte Android 10: Comportamiento de las aplicaciones en segundo plano.
Componente: wd300std.dll
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 21/11/2024

Señalar un error o enviar una sugerencia | Ayuda local