在用户提示“手动关闭"之前,WiX会在卸载时调用应用程序 [英] WiX call app on uninstall before User prompt "close manually"
问题描述
我有一个安装程序,可以安装应用程序,并在安装完成后立即启动该程序.这对我来说正常工作.
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.
我需要使用自定义操作来执行此操作,WM_CLOSE消息在我的方法中不起作用(确实,我尝试了几次).
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:
我定义了一个CustomAction:
I defined a CustomAction:
<CustomAction Id="CloseTrayApp" ExeCommand="-exit" FileKey="TrayApp" Execute="immediate" Return="asyncNoWait" />
并称其为:
<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"
是正确的选择.
推荐答案
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.
否则,如果您确实要调用EXE,建议不要使用EXE自定义操作.而是使用安静执行自定义操作.出于某些原因,请参见 EXE自定义操作的集成障碍.
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.
这篇关于在用户提示“手动关闭"之前,WiX会在卸载时调用应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!