PDA

View Full Version : How to abort installation from VB Script CA



IgorS1
07-01-2004, 04:39 AM
Hi
I use InstallShield Devstudio 9.0 (with Service Pack 1)
The question is -
How can I abort (or quit with rollback) installation from VB Script
deferred Custom Action ?
This code doesn't help. It only displays the message
-----------------------------------------------------------------
const msiMessageTypeFatalExit = &H00000000
const msiMessageTypeError = &H01000000

public sub ShowMessage()
Dim Record
Set Record = Installer.CreateRecord(1)
Record.IntegerData(1) = 0
Session.Message msiMessageTypeFatalExit, Record
end sub
---------------------------------------------------------------

Any ideas ?

Thanks

IgorS1
07-01-2004, 06:07 AM
Hi.
I found the answer to my own question
VB Script function (and not sub) should return error code value
This code works good - aborts installation with rollback
--------------------------------------------------------------------------
Option Explicit
const msiMessageTypeFatalExit = &H00000000
const msiMessageTypeError = &H01000000

const msiDoActionStatusSuccess = 1 'Action completed successfully.
const msiDoActionStatusUserExit = 2 'Premature termination by user.
const msiDoActionStatusFailure = 3 'Unrecoverable error. Returned if there is an error during parsing or

public function ShowMessage()
dim objRecord
Set objRecord = Session.Installer.CreateRecord(3)
objRecord.IntegerData(1) = 25000
objRecord.StringData(2) = "My Error"
Session.Message msiMessageTypeError, objRecord
ShowMessage = msiDoActionStatusFailure
end function
-------------------------------------------------------------------------

RobertDickau
07-01-2004, 07:40 AM
(Perhaps see also this newsletter tip: http://www.installshield.com/news/newsletter/0308-articles/msi.asp...)

IgorS1
07-01-2004, 07:46 AM
Thank you.
I didn't know about the limitation.