PDA

View Full Version : Help! - Custom Action Vbscript to terminate install



mchallis
10-19-2001, 05:23 AM
Can anyone help me get started with Express 3.51?

I am using a VBScript custome action. During the action I either want the install to continue, or force the install to quit.

How is it possible within VBScript to tell the Installer NOT to continue the install process?

I see that C/C++ custom action DLL's can return a value to indicate this, but how is the equivalent done via a script custom action?

This is driving me nuts!

:confused:

Mike

PS Thanks in advance

Chandima
10-19-2001, 08:47 AM
Try getting your script to return a 0 or a 1. One of these should terminate the install. This is what the C++ code uses for it's DLL Custom Actions. I don't see why a value returned by a DLL or a VBScript should make a difference to the installer.

mchallis
10-19-2001, 11:05 AM
Thanks for the advise, but the return code only seems to apply to C/C++ DLL's.

ActiveX (or COM) Dlls cannot be called directly via a custom action they would need script such as:

Dim myObj
Set myObj=CreateObject("MyDLL.MyClass")

myObj.DoAMethodNow

Set myObj=Nothing



Using VBScript, the only concept of a return value is if a function is used, e.g.

function foo()
foo=0
end function

I have tried this, and although the function is definately being called the return value (0 or non-zero) makes no odds, the installer trundles on anyway....

It seems ridiculous to me that only a C/C++ custom action can influence the script in any way.

Looking at the Windows Installer API, there appears to be no simple COM based solution to affecting the installer progress, unless someone knows different.....

Regards,

Mike

hofmann
10-30-2001, 07:31 AM
function foo()
foo = 1627
end function

this will work.

If you want to display a nice message, you can use session.Message (I didn't test that)


you could use an appropriate value from this set
#define ERROR_INSTALL_USEREXIT 1602L // User cancel installation.
#define ERROR_INSTALL_FAILURE 1603L // Fatal error during installation.
#define ERROR_FUNCTION_FAILED 1627L // Function failed during execution.

Chandima
10-30-2001, 11:35 AM
Thank you very much for this post!