function runs the specified application.
This function is provided for compatibility with earlier versions of Windows.
For Win32-based applications, use the CreateProcess
| LPCSTR lpCmdLine,
||// address of command line
| UINT uCmdShow
||// window style for new application
Points to a null-terminated character string that contains the command line
(filename plus optional parameters) for the application to be executed. If the
name of the executable file in the lpCmdLine
parameter does not contain a directory path, Windows searches for the
executable file in this sequence:
- The directory from which the application loaded.
- The current directory.
- The Windows system directory. The GetSystemDirectory function retrieves the path of this directory.
- The Windows directory. The GetWindowsDirectory function retrieves the path of this directory.
- The directories listed in the PATH environment variable.
Specifies how a Windows-based application window is to be shown and is used to
supply the wShowWindow
member of the STARTUPINFO
parameter to the CreateProcess
function. For a list of the acceptable values, see the description of the nCmdShow
parameter of the ShowWindow
function. For a non-Windows
based application, the PIF file, if any, for the application determines the
If the function succeeds, the return value is greater than 31.
If the function fails, the return value is one of the following error values:
||The system is out of memory or resources.
||The .EXE file is invalid (non-Win32 .EXE or error in .EXE image).
||The specified file was not found.
||The specified path was not found.
Win32-based applications should use the CreateProcess
function rather than this function. The WinExec
function exists in Win32 to provide compatibility with earlier versions of
Windows. For more information about how the WinExec
function is implemented, see the Remarks section of the LoadModule
In Win32, the WinExec
function returns when the started process calls the GetMessage
function or a time-out limit is reached. To avoid waiting for the time out
delay, call the GetMessage
function as soon as possible in any process started by a call to WinExec
- Software for developers
Software for Android Developers
- More information resources
Unix Manual Pages