16,472
社区成员
发帖
与我相关
我的任务
分享
……//执行其他的任务
WinExec("SetProxycn.exe",SW_SHOW);
……//紧接着执行其他的任务
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
// Start the child process.
if( !CreateProcess( _T("SetProxycn.exe"), // No module name (use command line)
NULL, // 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;
}
// 等待进程结束.
WaitForSingleObject( pi.hProcess, INFINITE ); // <=====================
// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );