0
我想从createprocess函数的代码中启动一个进程。命令行是好的,另一个EXE,我可以从Visual Studio没有问题地启动它。CreateProcess函数问题
当我试图从createprocess的其他进程启动它时,它给了我 - 运行时错误此应用程序请求运行时以非常规方式终止它。
可能是什么问题?我怎样才能消除这个问题?
STARTUPINFO si;
PROCESS_INFORMATION pi;
bool bResult;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
ZeroMemory(&pi, sizeof(pi));
//Cast System::String* __gc to char*
char* chAppName = (char*)(void*)Marshal::StringToHGlobalAnsi(AppName);
char* chCmdLine = (char*)(void*)Marshal::StringToHGlobalAnsi(CmdLine);
//Start the child process.
bResult = CreateProcess(chAppName, // No module name (use command line)
chCmdLine, // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
0, // No creation flags
NULL, // Use parent's environment block
NULL, // Use parent's starting directory
&si, // Pointer to STARTUPINFO structure
&pi); // Pointer to PROCESS_INFORMATION structure
你的意思是c#而不是C++? –
您可以发布您用于创建过程的代码吗? – doctorlove
我正在使用托管C++(C++。NET)。 –