我在学习CreateProcess:
为什么执行后fRet=0呢
void Dlg::OnButton1()
{
PROCESS_INFORMATION pi;
STARTUPINFO si;
si.cb=sizeof(si);
si.wShowWindow=SW_SHOW;
BOOL fRet=CreateProcess(NULL, "c:\\winnt\\notepad.exe c:\\1.txt",
NULL,
NULL,
FALSE,
NORMAL_PRIORITY_CLASS|CREATE_NEW_CONSOLE,
NULL,
NULL,
&si,
&pi);
}
为什么执行后fRet=0呢
void Dlg::OnButton1()
{
PROCESS_INFORMATION pi;
STARTUPINFO si;
si.cb=sizeof(si);
si.wShowWindow=SW_SHOW;
BOOL fRet=CreateProcess(NULL, "c:\\winnt\\notepad.exe c:\\1.txt",
NULL,
NULL,
FALSE,
NORMAL_PRIORITY_CLASS|CREATE_NEW_CONSOLE,
NULL,
NULL,
&si,
&pi);
}
STARTUPINFO si;
memset(&si, 0, sizeof(si)); // add this line
si.cb=sizeof(si);
si.wShowWindow=SW_SHOW; BOOL fRet=CreateProcess(NULL, "c:\\winnt\\notepad.exe c:\\1.txt",
NULL,
NULL,
FALSE,
NORMAL_PRIORITY_CLASS|CREATE_NEW_CONSOLE,
NULL,
NULL,
&si,
&pi);