WiX call app on uninstall before User prompt “close manually”

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-22 13:58:28

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/9836773/wix-call-app-on-uninstall-before-user-prompt-close-manually

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!