PC SOFT

WINDEV的在线文档

  • Using a command line
  • Using the exeActive constant
  • Return value of a WinDev executable
  • Starting an application in Windows Vista (and later)
  • Various
文档页面当前正在翻译。对于此延迟我们深表歉意。
您可以自愿地帮助我们翻译您想要的文档段落,然后只需通过以下地址与我们联系:info@cn.windev.com
产品
WinDevWebDev-服务器代码WebDev-浏览器代码WinDev Mobile报表和查询
平台
WindowsLinuxWindows MobileWindows PhoneWindows Store appsAndroidAndroid Widget iPhone/iPad
语言
JavaPHPAjax用户代码(MCU)外部语言
数据库
HFSQLHFSQL Client/Server存储过程HF 5.5OLE DBODBC本地访问

Starts the execution of a program (an executable for example) from the current application. This allows you to retrieve:
  • the return value of the executable with the 可执行文件.返回值 constant.
  • the identifier of the process, also called PID with the 可执行文件.进程ID constant.

Notes:
  • From Windows Vista, the applications may fail to start if the UAC mechanism is enabled. See Notes for more details.
  • In 64-bit Windows, the access to a system directory from a 32-bit executable can be performed in a directory that differs from the expected one. See Native 64-bit and native 32-bit for more details.
例子
// Start Notepad in default mode
启动应用程序"NOTEPAD.EXE Readme.txt"

// Start a program with long name containing space characters
// For example: Word with "My documents" as working directory

// Solution 1: Using the syntax specific to the multi-line strings
// (to avoid doubling or tripling the quotes)
如果启动应用程序(【
"C:\Program Files\Microsoft Office\Office12\WINWORD.EXE"
】,...
可执行文件.活动可执行文件.无等待系统目录系统目录.我的文档))=,那么
错误错误信息())
结束

// Solution 2: Doubling the quotes
启动应用程序"""C:\Program Files\Microsoft Office\Office12\WINWORD.EXE""",...
可执行文件.活动可执行文件.无等待系统目录系统目录.我的文档))

// Start applications with a file in command line
// Name of the application to start
sAppName字符串型"C:\Program Files\Adobe\Photoshop 6.0\Photoshp.exe"
// Name of the image to open
sImageName字符串型"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"
如果启动应用程序字符串创建(【
"%1" "%2"
】,sAppNamesImageName))=,那么
错误错误信息())
结束

语法

Running an executable (in locking or non-locking mode) 隐藏详细信息

<Result> = 启动应用程序(<Program Name> [, <Mode> [, <Wait for End> [, <Working Directory>]]])
<Result>: Boolean
  • if the program was started,
  • otherwise. 错误信息 returns more details about the error.
<Program Name>: Character string
Name of the 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
Mode used to start the program (no action on the DOS programs).
可执行文件.活动
(Default value)
The program run is active, it "takes control" over the current program
可执行文件.最小化The program run is inactive and it is minimized.

可执行文件.禁用The program run is inactive: it is run while the current program keeps focus
可执行文件.最大化The program run is active, it "takes control" over the current program (the execution window is maximized)

<Wait for End>: Optional Boolean constant
Configures the time-out before resuming the execution of the current program:
可执行文件.等待The current program resumes its execution when the program run is over.
可执行文件.无等待
(Default value)
The current program and the program run are run in parallel.

<Working Directory>: Optional character string
Working directory of the application to start.

WinDevWindowsLinux用户代码(MCU)

Starting a program and retrieving a value 隐藏详细信息

<Result> = 启动应用程序(<Program Name> [, <Mode> [, <Element to Return> [, <Working Directory>]]])
<Result>: Integer
Sought value:
  • Return value of the executable if <Element to Return> corresponds to the 可执行文件.返回值 constant.
  • PID of the executable if <Element to Return> corresponds to the 可执行文件.进程ID constant.
错误信息 is used to find out whether an error occurred.
<Program Name>: Character string
Name of the 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
Mode used to start the program (no action on the DOS programs).
可执行文件.活动
(Default value)
The program run is active, it "takes control" over the current program
可执行文件.最小化The program run is inactive and it is minimized

可执行文件.禁用The program run is inactive: it is run while the current program keeps focus
可执行文件.最大化The program run is active, it "takes control" over the current program (the execution window is maximized)

<Element to Return>: Optional constant
Configures the result of the function:
可执行文件.返回值The current program resumes its execution when the program run is over. <Result> corresponds to the return value of the executable.
可执行文件.进程IDThe current program and the program run are run in parallel. <Result> corresponds to the identifier of the 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.

<Working Directory>: Optional character string
Working directory of the application to start.

注意

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.

If the program run was developed with WinDev, 命令行 allows you to retrieve the command line.

WinDevWindowsLinux用户代码(MCU)

Using the exeActive constant

If the process where the application is run (with the 可执行文件.活动 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 not:

  • call another window or dialog box after the call to 启动应用程序,
  • call 重新输入 after 启动应用程序.
Furthermore, the possible button whose process contains a call to 启动应用程序 must not be a "Tab Stop" button ("Accessible by TAB" in the "Details" tab of the control description).

WinDevWindowsLinux用户代码(MCU)

Return value of a WinDev executable

A WinDev executable can return a value. You must:
  1. Create an Integer variable global to the project.
  2. Initialize this variable with the value to return.
  3. Return this variable with the 返回 statement keyword in the closing code of the project.

WinDevWindows用户代码(MCU)

Starting an application in Windows Vista (and later)

If the UAC is enabled, the application that is using 启动应用程序 to start another application must have higher rights 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 also have the ability to use 启动关联应用程序.

WinDevWindowsLinux用户代码(MCU)

Various

  • 启动应用程序 does not modify the current directory. The current directory before the call to 启动应用程序 is identical to the current directory after the call to 启动应用程序.
  • If the program run ignores the specified runtime mode, the program is run in 可执行文件.活动 mode.

组件
WinDev wd200std.dll
Linux wd200std.so