3

I got an installer which installs an application and starts this one right after the installation was finished. This works properly for me.

But now I want to stop that application while uninstalling the application, i don't want the user to be prompted to close applications manually. This shall work full automatic.

I ned to do this using a custom action, the WM_CLOSE message will not work in my approach (really, i tried it a couple of times).

I thought that this can't be that difficult, but I don't get it to work. What I did so far:

I defined a CustomAction:

<CustomAction Id="CloseTrayApp" ExeCommand="-exit" FileKey="TrayApp" Execute="immediate" Return="asyncNoWait" />

and called it liek this:

<InstallExecuteSequence>
...
    <Custom Action="CloseTrayApp" Before="InstallValidate" />
...
</InstallExecuteSequence>

But this does not work. I guess that I'm sheduling my custom action wrong, but I can't figure out the correct time to do it.

Are there any suggestions regarding the time/place to shedule the custom action in? I'm quite unsure if

Before="InstallValidate"

is the right place to do it.

inva
  • 751
  • 2
  • 13
  • 28
  • when you say "this doesn't work" - what do you mean? any errors in the log file? – Yan Sklyarenko Mar 23 '12 at 10:15
  • How can i view the logfile? Doesn't work means, that I still get the "close apps manually" dialog, the installer says it failed and the process is still running. – inva Mar 23 '12 at 10:25
  • in order to generate the verbose log file you should run the installation with /l*v command line switch. Like this: `msiexec /i MyApplication.msi /l*v MyLogFile.txt` – Yan Sklyarenko Mar 23 '12 at 12:41
  • possible duplicate of [WiX close application before uninstall - close open applications message](http://stackoverflow.com/questions/9822010/wix-close-application-before-uninstall-close-open-applications-message) – Christopher Painter Mar 23 '12 at 13:17

1 Answers1

3

Per the FilesInUse Dialog help topic, before InstallValidate is the correct place to schedule the custom action. But I'm confused as to why the WM_CLOSE won't work for you. I saw you asked another question and accepted it as the answer. Perhaps your TrayApp could have a "hidden" form that the user never sees but is running to receive the WM_CLOSE message. This is a trick I've done many times over the years.

Otherwise, if you really want to call your EXE, I suggest never using an EXE custom action. Instead use the Quiet Execution Custom Action. For some reasons on why to do this see Integration Hurdles for EXE Custom Actions.

Christopher Painter
  • 54,556
  • 6
  • 63
  • 100
  • thanks for your reply, i've already tried to use a hidden form, but i experienced that every time i triggered some action from my task bar icon, the wm_close message was send, and therefore the application was closed because i'm not able to make up a difference between an uninstaller wm_close message and a common wm_close message – inva Mar 26 '12 at 14:09