Archive: ShellExecute + ExecWait complications


ShellExecute + ExecWait complications
Hi there

I have constructed an installer which will detect and uninstall the previous (msi) version, via a call to ExecWait, after which the new (nsis) install continues. This works perfectly under normal conditions.

The problem comes during the program's built-in update feature. When it detects an update, it downloads it and runs it via a win32 call to ShellExecute(). The installer runs, detects the old version and executes (ExecWait) the uninstall. When the uninstall finishes the new install fails to resume, and the install hangs.

Any clues?

TIA
Tim


OK so I've narrowed it down a bit... perhaps ExecWait is not hanging after all (I'm a bit of a n00b here, probably should do some logging or something here).

Anyway, I was not passing a show command in my ShellExecute:

ShellExecute(NULL, "open", [path to installer], NULL, NULL, NULL);

If i use:

ShellExecute(NULL, "open", [path to installer], NULL, NULL, SW_SHOWNORMAL);

Then it works. That doesn't solve my problem though, since my program is already out in the wild and I can't change that call. However it does indicate that perhaps the installer is returning from ExecWait, but the next dialog is just not showing. Is there a way to get the installer to tell itself to show?

cheers
Tim


hah solved it using BringToFront:

Function onGUIInit
BringToFront
FunctionEnd

Thankyou everybody. I've achieved more in 24 hours with NSIS than I did in a year with MSI. Wonderful.