createprocess并行运算
#include "stdafx.h"
#include "windows.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
TCHAR command[MAX_PATH];
sprintf_s(command,"windows_study.exe");//保持本程序的exe文件名在command中
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
if(! CreateProcess(NULL,
command,
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&si,
&pi))
{
cout<<"createprocess failed"<<endl;
}
cout<<"aa"<<endl;
system("pause");
}
效果如图: