开发者

Cancel an MSI without showing the "installation interrupted" dialog

开发者 https://www.devze.com 2023-01-08 02:53 出处:网络
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 redunda

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, "AbortInsta开发者_开发问答ll" 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!


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.


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:

<Publish Dialog="WelcomeDlg" Control="Cancel" Event="Finish" Value="Exit">1</Publish>

Let me know how it goes :)


Just FYI & fun.
How to hide Exit dialog in wix:
In your custom WixUI_xxxxx.wxs under <UI> tag place

<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return">1</Publish>
<Publish Dialog="MyNewDlg" Control="Ok" Event="EndDialog" Value="Return" Order="1">1</Publish>

Under <Product> tag insert:

<Property Id="ExitSuccess" Value="1" />

And

<InstallUISequence>
  <Show Dialog="MyNewDlg" After="SomeAction">Installed</Show>
  <Show Dialog="ExitDialog" OnExit="success">NOT ExitSuccess = 1</Show>
</InstallUISequence>

That's all.

0

精彩评论

暂无评论...
验证码 换一张
取 消