CaMsgBox() |
This function can be used in any generated jscript or vbscript custom actions.
This function displays a message box (popup), you should never use any other mechanism to display messages or you will have problems if you attempt to automate the install of your MSI.
The VBSCRIPT variation returns the message boxes return code (such as "vbYes").
The function takes these parameters:
The VBSCRIPT variation allows you to also pass an integer value (such as "4" or vbYesNo). See the VBSCRIPT "MsgBox" documentation as the same "buttons" or return code values.
The boxes will only be seen when you have a have a user interface, so you may or not see the a message box depending on how an install or uninstall is invoked. As the message is logged you will still see that they occurred.
EXAMPLE - VBSCRIPT |
<$VbsCa Binary="TestCaMsgBox.vbs"> <$VbsCaEntry "StartTest"> dim Answer do until Answer = vbCancel ;--- Display the QUESTION --------------------------------------- Answer = CaMsgBox(vbYesNoCancel+vbDefaultButton2, "Want to dance?") ;--- Display the selected answer -------------------------------- select case Answer ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%% case vbCancel ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CaMsgBox "I", "You pressed CANCEL (the end)!" ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%% case vbYes ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CaMsgBox "I", "You pressed YES (press CANCEL to exit loop)." ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%% case vbNo ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CaMsgBox "I", "You pressed NO (press CANCEL to exit loop)." ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%% case else ;%%%%%%%%%%%%%%%%%%%%%%%%%%%%% CaMsgBox "E", "OK, I certainly didn't expect that one. Answer was " & Answer exit do end select loop ;--- Make install fail, we were just testing the above! -------------- VbsCaRaiseError "StartTest()", "Making install fail as CaMsgBox() testing complete!" <$/VbsCaEntry> <$/VbsCa> <$VbsCaSetup Binary="TestCaMsgBox.vbs" Entry="StartTest" Seq="LaunchConditions-" Type="immediate" SeqTable="InstallUISequence" CONDITION=^<$VBSCA_CONDITION_INSTALL_ONLY>^>