创建一个进程来执行另一个程序

来源:互联网 发布:配置网络 ubuntu 编辑:程序博客网 时间:2024/05/01 10:03
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)szTemp,        // Command lineNULL,           // Process handle not inheritableNULL,           // Thread handle not inheritableFALSE,          // Set handle inheritance to FALSE0,              // No creation flagsNULL,           // Use parent's environment blockNULL,           // Use parent's starting directory &si,            // Pointer to STARTUPINFO structure&pi )           // Pointer to PROCESS_INFORMATION structure) {return;}// Wait until child process exits.//WaitForSingleObject( pi.hProcess, INFINITE );// Close process and thread handles. CloseHandle( pi.hProcess );CloseHandle( pi.hThread );

0 0
原创粉丝点击