使用CreateProcess()函数

时间:2010-04-22 16:14:06  来源:第二电脑网  作者:第二电脑网

  第二电脑网导读:ure.siStartInfo.cb = sizeof(STARTUPINFO); siStartInfo.lpReserved = NULL;siStartInfo.lpReserved2 = NULL; siStartInfo.cbReserved2 = 0;siStartInfo.lpDesktop = NULL; siStartInfo.dwFlags = 0;// Create the child process.CreateProcess(NULL,strCmdLine.c_str(),NULL, // process security attributesNULL, // pri...
  正文:以下是一个使用CreateProcess()函数的例子:
void CreateChildProcessAndWaitUntilDone(const AnsiString& strCmdLine)
{

PROCESS_INFORMATION piProcInfo;
STARTUPINFO siStartInfo;

// Set up members of STARTUPINFO structure.
siStartInfo.cb = sizeof(STARTUPINFO);
siStartInfo.lpReserved = NULL;
siStartInfo.lpReserved2 = NULL;
siStartInfo.cbReserved2 = 0;
siStartInfo.lpDesktop = NULL;
siStartInfo.dwFlags = 0;


// Create the child process.
CreateProcess(

NULL,
strCmdLine.c_str(),
NULL, // process security attributes
NULL, // primary thread security attributes
0, // handles are inherited
0, // creation flags
NULL, // use parent's environment
NULL, // use parent's current directory
&siStartInfo, // STARTUPINFO pointer
&piProcInfo); // receives PROCESS_INFORMATION

// Wait for the processs to finish
Dword rc = WaitForSingleObject(
piProcInfo.hProcess, // process handle
INFINITE);
}

"使用CreateProcess()函数"由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Language/VC/2010-04-22/13749.html


关键字:

关于《使用CreateProcess()函数》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td