CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2010

    CreateProcess to invoke msiexec

    I am trying to invoke msiexec from within a c++ program by doing

    if( !CreateProcess(NULL, commandLine,
    &si, &pi ) )
    <handle the error>
    WaitForSingleObject( pi.hProcess, INFINITE );
    <check error codes, etc>

    The commandLine is “msiexec /qn+ /l* <user named logfile> /i <user selected msi file>”. When the CreateProcess is executed, the Windows Installer “preparing to install” dialog appears for a few seconds and then disappears and then when all is done the dialog indicating that the installation completed ok appears. When that dialog is OK’ed control returns to my program but now the “preparing to install” dialog is present again and it will not go away until I exit my program. The checks made after the WaitForSingleObject called indicated that all was successful (and separately verified that the installed product was present and usable).

    What do I have to do differently to prevent the seemingly extraneous installer activity after control returns to my program?

  2. #2
    Join Date
    Jan 2009

    Re: CreateProcess to invoke msiexec

    I know this is an obvious question but have you wrapped all the path value with \"

    Another odd thought: Is your program repainting the window properly?
    What I mean is, could what you're seeing be the first "preparing to install" dialog image left behind on your application's window?
    Another way to put this question is: Have you made sure that you are calling CreateProcess in a thread separate to your main message loop thread?
    Alternatively you might choose to use MsgWaitForMultipleObjectsEx in your message loop thread, which will complicate your main message loop.
    Last edited by dexblack; July 9th, 2010 at 07:03 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.