CreateProcess参数问题
#include<windows.h>#include<iostream>
using namespace std;
int main(int argc,char*argv[]){
char*szCommandLine="cmd";
STARTUPINFO si={sizeof(si)};
PROCESS_INFORMATION pi;
si.dwFlags=STARTF_USESHOWWINDOW;
si.wShowWindow=TRUE;
BOOL bRet=::CreateProcess(
NULL,
szCommandLine,
NULL,
NULL,
FALSE,
CREATE_NEW_CONSOLE,
NULL,
NULL,
&si,
&pi);
if(bRet)
{
::CloseHandle(pi.hProcess);
::CloseHandle(pi.hThread);
cout<<"新的进程Id:"<<pi.dwProcessId<<endl;
cout<<"新的主线程Id:"<<pi.hThread<<endl;
}
return 0;
}
各位大侠帮帮看看那里有问题感觉szCommandLine有问题