devios1
devios1

Reputation: 37985

Cancel an MSI without showing the "installation interrupted" dialog

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!

Upvotes: 4

Views: 3822

Answers (3)

Dimiano
Dimiano

Reputation: 414

Just FYI & fun.
How to hide Exit dialog in :
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.

Upvotes: 1

Ray Dey
Ray Dey

Reputation: 885

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 :)

Upvotes: 1

Christopher Painter
Christopher Painter

Reputation: 55581

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.

Upvotes: 3

Related Questions