CString strName = "test.exe";
if(m_strWorkingPath.IsEmpty())
GetWorkingFileName();
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(STARTUPINFO)) ;
si.cb = sizeof(STARTUPINFO);
CreateProcess(m_strWorkingPath + "//"+ strName, NULL, NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi)
UINT WinExec(
LPCSTR lpCmdLine, // command line
UINT uCmdShow // window style
);
This function is provided only for compatibility with 16-bit Windows. Win32-based applications should use the CreateProcess function.
例如:
WinExec("c://winnt//notpad.exe",SW_SHOW);
三个SDK函数winexec,shellexecute,createprocess可以使用。
1)UINT WinExec(LPCSTR lpCmdLine, UINT uCmdShow );最简单,前一个参数制定路径,后一个指定显示方式
2)ShellExecute(....);灵活一点
3)CreateProcess()最复杂,一共十个参数,它可以指定进程的安全属性,继承信息,类的优先级等等