取消 MSI,而不显示“安装已中断”对话
我想知道是否可以使用欢迎屏幕上的“取消”按钮完全退出安装程序,而不显示最终的“安装中断”对话框。当用户还没有开始安装时,我认为这是多余的。
如果用户取消已经开始的安装,我仍然希望显示该对话框,但如果安装尚未开始(如果点击了“取消”按钮,就会出现这种情况)欢迎屏幕)。
我尝试过各种方法,但对 Windows Installer 如何理解解决方案缺乏正确的理解。
更新:开始工作了!我最终结合使用了这两个建议——我希望我能给你们两个答案,但我会把它给雷,因为他的代表最低。但我会给他们俩投票。以下是我的做法(我仍然对它的工作原理感到惊讶):
我按照 ray 的建议使用了 Publish 元素,但我没有调用一个事件(没有名为“Finish”的事件),而是设置了一个属性,“AbortInstall”到 1
:
<Publish Dialog="SimpleDlg"
Control="Cancel"
Property="AbortInstall"
Value="1">1</Publish>
我在 Wix/Fragment/UI 下的自定义设置文件 WixUI_Simple.wxs 中执行了此操作
然后,在 UserExit.wxs 内我修改了 InstallUISequence,如下所示:
<InstallUISequence>
<Show Dialog="Simple_UserExit"
OnExit="cancel">NOT AbortInstall = 1</Show>
</InstallUISequence>
...这是克里斯托弗提出的想法。
谢谢你们俩!
I am wondering if it is possible to have the "Cancel" button on my welcome screen completely quit the installer without showing the final "Installation interrupted" dialog. I consider this redundant when the user hasn't even begun the installation yet.
I still want the dialog to be shown if the user cancels an installation that has already been started, but not if the installation hasn't been started (which is the case if the Cancel button is hit on the welcome screen).
I have tried various things but I lack a proper understanding of how Windows Installer works to fathom a solution.
Update: Got it to work! I ended up using a combination of the two suggestions--I wish I could give you both the answer, but I'll give it to ray as he has the lowest rep. But I'll upvote them both. Here's how I did it (I'm still surprised it works):
I used the Publish
element as ray suggested, but instead of invoking an event (there's no event called "Finish"), I set a property, "AbortInstall" to 1
:
<Publish Dialog="SimpleDlg"
Control="Cancel"
Property="AbortInstall"
Value="1">1</Publish>
I did this in my custom set file WixUI_Simple.wxs under Wix/Fragment/UI
Then, inside UserExit.wxs I modified the InstallUISequence as follows:
<InstallUISequence>
<Show Dialog="Simple_UserExit"
OnExit="cancel">NOT AbortInstall = 1</Show>
</InstallUISequence>
...which is the idea suggested by Christopher.
Thanks to you both!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查看您的 InstallUISequence 表:
http://msdn .microsoft.com/en-us/library/aa369543(VS.85).aspx
请注意带有 -1、-2 和 -3 序列的特殊对话框。请注意,您还可以在对话框中添加条件。只需一点创意,您就可以使用属性作为标志来确定您的安装是否真正开始并阻止或显示有问题的对话框。
Take a look at your InstallUISequence table:
http://msdn.microsoft.com/en-us/library/aa369543(VS.85).aspx
Notice the special dialogs with a sequence of -1, -2 and -3. Notice that you can also put a condition on the dialogs. With a little creatavity you can use a property as a flag to determine whether your install ever really began and prevent or show the dialog in question.
我还没有测试过这个,所以它可能一点也不起作用,但那又怎么样。
您可能可以为“取消”按钮控件上的“WelcomeDlg”创建一个“发布”元素,如下所示:
让我知道它是如何进行的:)
I haven't tested this so it might not work in the slightest, but what the hell.
You probably can create a Publish element for the WelcomeDlg on the Cancel button control like so:
Let me know how it goes :)
仅供参考有趣。
如何在 wix< 中隐藏退出对话框 /a>:
在您的自定义 WixUI_xxxxx.wxs 下的
标记位置在
标签下插入:和
就这样。
Just FYI & fun.
How to hide Exit dialog in wix:
In your custom WixUI_xxxxx.wxs under
<UI>
tag placeUnder
<Product>
tag insert:And
That's all.