急需高手救命啊~ 为什么在使用CreateProcess函数后,调用CloseHandle之前必须使用AfxMessageBox(),否则就在运行时死机?
各位高手帮帮忙啊!
为什么在使用CreateProcess函数后,调用CloseHandle之前必须使用AfxMessageBox(),否则就在运行时死机?
if(!CreateProcess(NULL,tmp.GetBuffer(0),NULL,NULL,TRUE,0,NULL,tmpn.GetBuffer(0),&sui,&pi))
{
CloseHandle(hRead);
CloseHandle(hWrite);
hRead = NULL;
hWrite = NULL;
return;
}
else
{
AfxMessageBox("编译成功");
char buf[400];
DWORD dwRead;
if(!ReadFile(hRead,buf,400,&dwRead,NULL))
{
return;
}
strShowCompiler = buf;
AppandToShow(buf);
CloseHandle(pi.hProcess);
CloseHandle(pi.hThread);
}
只要注释掉 //AfxMessageBox("编译成功");
就会在运行的时候死机!
还有个问题:
我创建的匿名管道使用标准输入输出和标准出错,为什么我得到的没有vc编译器的比如warning,error之类的,只有一些微软的公司信息呢?