0
我嘗試使用下面的代碼安裝盾窗口沒有頂上來
DWORD ChildProcess(LPCSTR exePath, LPCSTR lpCmdLine ,BOOL showDialog, char* workingDir, BOOL bParentWait)
{
CWnd * handle = AfxGetMainWnd(); //handle to the main dialog box of mfc application
DWORD dwExitCode = -1;
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.lpVerb = "open";
ShExecInfo.lpFile = exePath; //setup.exe path, installer exe
if(bParentWait)
{
ShExecInfo.lpParameters = lpCmdLine;
ShExecInfo.nShow = SW_MINIMIZE;
}
else
{
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.lpParameters = NULL;
}
ShExecInfo.lpDirectory = workingDir;
ShExecInfo.hInstApp = NULL;
if (ShellExecuteEx(&ShExecInfo))
{
if(bParentWait)
{
handle->ShowWindow(SW_MINIMIZE);
WaitForSingleObject(ShExecInfo.hProcess,INFINITE);
if(showDialog){
handle->ShowWindow(SW_RESTORE);
}
GetExitCodeProcess(ShExecInfo.hProcess, &dwExitCode);
}
else
{
CloseHandle(ShExecInfo.hProcess);
dwExitCode = 0;
}
}
return dwExitCode;
}
問題推出即通過由一個Setup.exe安裝屏蔽是啓動安裝程序窗戶不在最上面。任何幫助將不勝感激。
感謝