古詩詞大全網 - 成語用法 - VC++的兩個程序組合

VC++的兩個程序組合

//m_sPath 是壹個存儲文件路徑的CString類型變量.

CString strPath = m_sPath + "YYreg.exe";

PROCESS_INFORMATION pi;

STARTUPINFO si;

memset(&si,0,sizeof(si));

si.cb = sizeof(si);

si.wShowWindow = SW_SHOW;

si.dwFlags = STARTF_USESHOWWINDOW;

BOOL fRet = CreateProcess(

NULL,

strPath.GetBuffer(strPath.GetLength()),

NULL,

NULL,

FALSE,

NORMAL_PRIORITY_CLASS|CREATE_NEW_CONSOLE,

NULL,

NULL,

&si,

&pi);

strPath.ReleaseBuffer(0);

if (fRet)

{

//打開成功

}