Platform SDK: DLLs, Processes, and Threads |
The WinExec function runs the specified application.
Note This function is provided only for compatibility with 16-bit Windows. Win32-based applications should use the CreateProcess function.
UINT WinExec( LPCSTR lpCmdLine, // command line UINT uCmdShow // window style );
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:
Value | Meaning |
---|---|
0 | The system is out of memory or resources. |
ERROR_BAD_FORMAT | The .exe file is invalid (non-Win32 .exe or error in .exe image). |
ERROR_FILE_NOT_FOUND | The specified file was not found. |
ERROR_PATH_NOT_FOUND | The specified path was not found. |
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.
Windows NT/2000: Requires Windows NT 3.1 or later.
Windows 95/98: Requires Windows 95 or later.
Header: Declared in Winbase.h; include Windows.h.
Library: Use Kernel32.lib.
Processes and Threads Overview, Process and Thread Functions, CreateProcess, GetMessage, GetSystemDirectory, GetWindowsDirectory, LoadModule, ShowWindow