创建进程失败,照msdn上抄的还错了。该怎么解决
创建进程失败,照msdn上抄的还错了。。
哪位愿意写上一段代码,创建进程并可以读取该子进程在内存中某一段的数据。。谢
------解决方案--------------------
你要确定MyChildProcess是有效的命令行
------解决方案--------------------
你确定你看完MSDN的全部信息了?MyChildProcess是什么东西你知道么?
------解决方案--------------------
MyChildProcess应该换成进程名
- C/C++ code
#include <windows.h> #include <stdio.h> void main( VOID ) { STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); // Start the child process. if( !CreateProcess( NULL, // No module name (use command line). TEXT("MyChildProcess"), // 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. ) { printf( "CreateProcess failed (%d).\n", GetLastError() ); return; } // Wait until child process exits. WaitForSingleObject( pi.hProcess, INFINITE ); // Close process and thread handles. CloseHandle( pi.hProcess ); CloseHandle( pi.hThread ); }
哪位愿意写上一段代码,创建进程并可以读取该子进程在内存中某一段的数据。。谢
------解决方案--------------------
你要确定MyChildProcess是有效的命令行
------解决方案--------------------
你确定你看完MSDN的全部信息了?MyChildProcess是什么东西你知道么?
------解决方案--------------------
MyChildProcess应该换成进程名