Vannes
2007-05-03 06:39:00 UTC
小弟使用CreateProcess()去開啟一個InstallShield 安裝程式, 該安裝程式在硬碟中只有一個process; 但在光碟中,
程式本身會將自己copy到硬碟中並開啟一個新的process執行. 小弟的成是需要等待整個安裝完成後在進行下一步, 然而這情況卻無法等下去了??
請問有甚麼解決的方法嗎? 小弟曾經試過將 bInheritHandles設為true, 但似乎還是不行...以下附上程式碼請各位高手解答, 謝謝!
//CreateProcess fuction variables
STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD dwExit;
TCHAR szdrvInstX64[MAX_PATH];
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
wsprintf(szdrvInstX64, "%s%s", szCurModPath, ITEM2SETUPPATH);
if( !CreateProcess( NULL, szdrvInstX64, NULL, NULL, FALSE, 0, NULL, NULL,
&si, &pi) )
{
::AfxMessageBox("CreateProcess() failed!");
return;
}
//Set itself to bottom.
::ShowWindow(hWndMain, SW_MINIMIZE);
WaitForSingleObject( pi.hProcess, INFINITE ); // Wait until child process
exits.
GetExitCodeProcess(pi.hProcess, &dwExit);
CloseHandle( pi.hProcess ); // Close process and thread handles.
CloseHandle( pi.hThread );
::ShowWindow(hWndMain, SW_RESTORE);
程式本身會將自己copy到硬碟中並開啟一個新的process執行. 小弟的成是需要等待整個安裝完成後在進行下一步, 然而這情況卻無法等下去了??
請問有甚麼解決的方法嗎? 小弟曾經試過將 bInheritHandles設為true, 但似乎還是不行...以下附上程式碼請各位高手解答, 謝謝!
//CreateProcess fuction variables
STARTUPINFO si;
PROCESS_INFORMATION pi;
DWORD dwExit;
TCHAR szdrvInstX64[MAX_PATH];
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
wsprintf(szdrvInstX64, "%s%s", szCurModPath, ITEM2SETUPPATH);
if( !CreateProcess( NULL, szdrvInstX64, NULL, NULL, FALSE, 0, NULL, NULL,
&si, &pi) )
{
::AfxMessageBox("CreateProcess() failed!");
return;
}
//Set itself to bottom.
::ShowWindow(hWndMain, SW_MINIMIZE);
WaitForSingleObject( pi.hProcess, INFINITE ); // Wait until child process
exits.
GetExitCodeProcess(pi.hProcess, &dwExit);
CloseHandle( pi.hProcess ); // Close process and thread handles.
CloseHandle( pi.hThread );
::ShowWindow(hWndMain, SW_RESTORE);