This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Message box from custom action
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 21, 2008
08:40 AM
Message box from custom action
Hi.
I need to show a message box with yes/no buttons and some text from custom action. My installation is MSI project and I wanted this message box to be shown from VB script. I googled for the samples but found nothing.
So is it possible to show standart Windows message box from VB code or some other custom action? Please give me a sample code, 'cause I'm nube in VB 😞
I need to show a message box with yes/no buttons and some text from custom action. My installation is MSI project and I wanted this message box to be shown from VB script. I googled for the samples but found nothing.
So is it possible to show standart Windows message box from VB code or some other custom action? Please give me a sample code, 'cause I'm nube in VB 😞
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Nov 21, 2008
03:20 PM
It is possible to use the MsgBox command in a VBScript CA but you have to account for the UILevel when showing the message box so as to not show it during a silent installation.
I use the Session.Message method to show messages as it handles the UILevel for you. The following code shows an informative message either to the log or screen depending on the UIlevel. Other codes can be used instead of &H03000000 to show an error or warning message.
I use the Session.Message method to show messages as it handles the UILevel for you. The following code shows an informative message either to the log or screen depending on the UIlevel. Other codes can be used instead of &H03000000 to show an error or warning message.
Set hMsgRecord = Installer.CreateRecord(0)
hMsgRecord.StringData(0) = "Test message"
Session.Message &H03000000, hMsgRecord
Set hMsgRecord = nothing
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 01, 2008
08:53 AM
esiemiat wrote:
It is possible to use the MsgBox command in a VBScript CA but you have to account for the UILevel when showing the message box so as to not show it during a silent installation.
I use the Session.Message method to show messages as it handles the UILevel for you. The following code shows an informative message either to the log or screen depending on the UIlevel. Other codes can be used instead of &H03000000 to show an error or warning message.
Set hMsgRecord = Installer.CreateRecord(0)
hMsgRecord.StringData(0) = "Test message"
Session.Message &H03000000, hMsgRecord
Set hMsgRecord = nothing
Thank you for reply. This code is good, but it does not solve one of my problems - the message should be localizable. How to get the message text from the resources?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 01, 2008
09:39 AM
To localize the message you will either need to use the Error table or a localized property.
More information about both options can be found in the help library. However, I included a sample from one of my installs that uses the error table.
[CODE]
Set hMsgRecord = Installer.CreateRecord(2)
hMsgRecord.IntegerData(1) = 25002 'Error message number in error table.
hMsgRecord.StringData(2) = sNetworkDir ' Replaces [2] in error message.
Session.Message msiMessageTypeError, hMsgRecord
Set hMsgRecord = nothing
[/CODE]
Here is the localizable message listed in the error table. Anything listed in {{}} will only be printed to the log file.
More information about both options can be found in the help library. However, I included a sample from one of my installs that uses the error table.
[CODE]
Set hMsgRecord = Installer.CreateRecord(2)
hMsgRecord.IntegerData(1) = 25002 'Error message number in error table.
hMsgRecord.StringData(2) = sNetworkDir ' Replaces [2] in error message.
Session.Message msiMessageTypeError, hMsgRecord
Set hMsgRecord = nothing
[/CODE]
Here is the localizable message listed in the error table. Anything listed in {{}} will only be printed to the log file.
The specified Pages network folder is not valid.{{Value='[2]'}}
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 03, 2008
04:16 AM
Thank you, you helped me much!