WinExec("\"C:\Program Files\MyApp.exe\" -L -S", ...) WinExec The WinExec function runs the specified application. Note This function is provided only for compatibility with 16-bit Windows. Applications should use the CreateProcess function. UINT WinExec( LPCSTR lpCmdLine, // command line UINT uCmdShow // window style ); Parameters lpCmdLine [in] Pointer to a null-terminated character string that contains the command line (file name 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, the system 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. uCmdShow [in] 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 window state.
WinExec
The WinExec function runs the specified application. Note This function is provided only for compatibility with 16-bit Windows. Applications should use the CreateProcess function. UINT WinExec(
LPCSTR lpCmdLine, // command line
UINT uCmdShow // window style
);
Parameters
lpCmdLine
[in] Pointer to a null-terminated character string that contains the command line (file name 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, the system 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.
uCmdShow
[in] 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 window state.
谢谢了。
PROCESS_INFORMATION ProcessInfo;
memset(&StartupInfo,0,sizeof(STARTUPINFO));
StartupInfo.cb=sizeof(STARTUPINFO);
StartupInfo.dwFlags=STARTF_USESHOWWINDOW;
StartupInfo.wShowWindow=SW_SHOWMINIMIZED;
::CreateProcess(NULL,"c:\\Program Files\\Microsoft Office\\Office\\WINWORD.exe",NULL,NULL,FALSE,0,
NULL,NULL,&StartupInfo,&ProcessInfo);
return;