0

以下のコードを使用して、install-shield で作成された setup.exe を起動しようとしています。

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;
}

問題は、起動したインストーラー ウィンドウが一番上に表示されないことです。どんな助けでも大歓迎です。

ありがとう

4

1 に答える 1

0

あなたが抱えている問題setup.exeは、UIシーケンスを実行する(したがってウィンドウを表示する)別のプロセスを生成するためだと思います。

于 2013-03-25T08:59:48.540 に答える