ksuwada
Posts: 16
Joined: Wed Jun 01, 2011 2:52 pm

User cancel installation from custom action

Hi!

I have an exe that I run using custom action, what code should I return to tell Advanced Installer just to cancel the setup. I dont want to display any error message - just go to the last dialog.

My custom action is under InstallUIsqeuence, i have tried to return 2 or 1602 as described here http://msdn.microsoft.com/en-us/library ... S.85).aspx
but it didnt work.

Kind regards
KS
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: User cancel installation from custom action

Hello,

Here is a sample VBScript that uses this return code:

Code: Select all

Function MsiMsgBox()

Dim msg
msg = "The folowing prerequisite is missing. Do you want to continue?"

Const msiMessageTypeUser = &H03000000
Const msiMessageStatusYes = 6
Const msiMessageStatusNo = 7

Set record = Session.Installer.CreateRecord(1)
record.StringData(0) = "[1]"
record.StringData(1) = CStr(msg)
ans=Session.Message(msiMessageTypeUser + vbYesNo, record)

If ans = msiMessageStatusNo Then
MsiMsgBox = 2
End If

End Function
You can adapt it to fit your needs.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
ksuwada
Posts: 16
Joined: Wed Jun 01, 2011 2:52 pm

Re: User cancel installation from custom action

Ok, so I need to run executable from vbs and then capture its return code to pass it back to Advanced Installer.

It's not very elegant but I will try this :)

Thanks!
KS
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: User cancel installation from custom action

Hello,

The custom action can be either an .EXE, .DLL, VBScript or JScript. I attached the custom action to exemplify a working return code usage.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”