MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: CaMkObject()[Next]: CaSleep()
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Source Code->VBSCRIPT->Custom Action Functions->CaMsgBox()

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:

  1. The type of popup to display, use "I" for information or "E" for error.

    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.

  2. The text of the message. Note that the whole text of the message is logged but Windows Installer won't show all of longish messages and can even "corrupt" any carriage returns or line feeds your text might contain.

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>^>


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: CaMkObject()[Next]: CaSleep()


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday May 28 2022 at 3:11pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.