May 19th, 2010, 12:32 PM
CreateProcess to invoke msiexec
I am trying to invoke msiexec from within a c++ program by doing
if( !CreateProcess(NULL, commandLine,
NULL, NULL, FALSE, 0, NULL, NULL,
&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?
July 8th, 2010, 05:27 PM
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
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!