Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3310306
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:44:40+00:00 2026-05-17T21:44:40+00:00

I am writing a master installer with the following ShellExecuteEx() function that call a

  • 0

I am writing a master installer with the following ShellExecuteEx() function that call a few Advanced Installer created installers (installing multiple products) one by one through a loop construct.

// Shell Execute 
bool CFileHelper::ShellExecute(CString strCommandPath, CString strOptions)
{

    CString strQCommandPath = CString(_T("\"")) + strCommandPath +  CString(_T("\""));  //place the command in the quote to handle path with space

    LPWSTR szInstallerPath = strQCommandPath.GetBuffer();
    LPWSTR szOptions = strOptions.GetBuffer(MAX_PATH);

    SHELLEXECUTEINFO ShellInfo; // Name structure

    memset(&ShellInfo, 0, sizeof(ShellInfo)); // Set up memory block
    ShellInfo.cbSize = sizeof(ShellInfo); // Set up structure size
    ShellInfo.hwnd = 0; // Calling window handle
    ShellInfo.lpVerb = _T("open"); 
    ShellInfo.lpFile = szInstallerPath; 
    ShellInfo.fMask = SEE_MASK_NOCLOSEPROCESS; //| SEE_MASK_NOASYNC | SEE_MASK_WAITFORINPUTIDLE;
    ShellInfo.lpParameters = szOptions;
    bool res = ShellExecuteEx(&ShellInfo); // Call to function
    if (!res)
    {
        //printf( "CreateProcess failed (%d).\n", GetLastError() );
        CString strMsg = CString(_T("Failed to execute command ")) + strCommandPath +  CString(_T("!"));
        AfxMessageBox(strMsg);
        return false;
    }

    WaitForSingleObject(ShellInfo.hProcess, INFINITE); // wait forever for process to finish
    //WaitForInputIdle(ShellInfo.hProcess, INFINITE);

    CloseHandle( ShellInfo.hProcess);

    strQCommandPath.ReleaseBuffer();
    strOptions.ReleaseBuffer();
    return true;
}

The function work every well when I have this master installer and other individual product installers on hard drive.

However, if I move all of them to either USB drive or CD, the ShellExecuteEx() didn’t wait for the previous product installer to complete its task. So all product installers get lunched at once; giving me the error message “Another installation is in progress. You must complete that installation before continuing this one.”.

One thing puzzle me is why it works on hard drive but not on USB drive and CD drive. I need to distribute the products on CD.

Putting Sleep(500) before WaitForSingleObject(ShellInfo.hProcess, INFINITE) didn’t help as well.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T21:44:40+00:00Added an answer on May 17, 2026 at 9:44 pm

    Work from the assumption that this is real. The installer might have noticed it was started from a removable drive and copied itself to the hard disk. Launched that copy and quit. This avoids trouble when the user pops out the media, that produces a very low-level paging fault that the process itself cannot catch. The Windows dialog isn’t great and may well run counter to the installer’s request to insert the next disk.

    Verify this guess by comparing the process ID of the process you started vs the one you see running in Taskmgr.exe. Reliably fixing this ought to be quite a headache.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing code on the master page, and I need to know which child
Writing a JSP page, what exactly does the <c:out> do? I've noticed that the
I writing a report in Visual Studio that takes a user input parameter and
I'm writing a little app for the Mac, that involves recording a voice. In
I'm writing Master's thesis. I nead some open source projects (written in C#) with
I'm writing a Master thesis when I need to include several photographs, but I've
I am writing an application which consists of a master server database (most probably
I was writing a class that uses __get() and __set() to store and retrieve
Writing some test scripts in IronPython, I want to verify whether a window is
Writing the code for the user authentication portion of a web site (including account

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.