With Wise for Windows Installer, Wise for Visual Studio .NET, and the Windows Installer Editor tool in Wise Package Studio, you can create and modify dialogs for your installation. In the dialogs you can add combo boxes, then set them up to dynamically populate in the database. This allows you to offer the end user more options based on information gathered from the target computer.
In most cases, you know the combo box options; because they are static, you can add the options during the installation development. To do this, add the combo box and its options to the dialog using the Dialog tab in Setup Editor. Other times, however, the combo box options are not static: you have not decided on them during installation development, or they changed after the installation was developed. The solution in these instances is to dynamically create and populate the combo box control during the installation.
Because the dialog control information is held within the MSI database, this list must be added as new rows to the MSI database during runtime. This requires you to use a custom action to create the rows in the .MSI that will dynamically populate the combo box. This article explains how to create this type of control.
Note: This article requires basic knowledge of VB Script. The data for the combo box in the example uses constants included in the VB Script. More advanced knowledge of VB Script may be necessary to use data from alternative locations.
There are three sets of procedures to dynamically create a list for a combobox at runtime.
To create a combo box control:
To create a VB Script custom action to dynamically populate the combo box:
Modifying the VB Script (.VBS file) provided with this article:
The Combobox.vbs script accompanying this article has two functions defined: Combo() and addToComboBox(). For samples of how to implement the Combobox.vbs file, see the PopulateCombobox.wsi and PopulateCombobox.msi files included with this article.
Instead of the Modify procedures above, you might want to use a VB Script to gather information from the destination machine using registry key values, an .INI file, text file, or using another method. If you use one of these methods, use the obtained values to populate the ComboProp, ComboOrder, ComboValue, and ComboText properties. Then call the addToComboBox() function.
The addToComboBox() function adds the appropriate row to the Combobox table of the .MSI file using the View object from the Windows Installer object model. To learn more about the Windows Installer properties and methods available within VB Script including those in this function, see the MicrosoftÂ® WindowsÂ® Installer SDK Help. The following Windows Installer SDK pages are relevant to this article:
With knowledge of VB Script and Windows Installer dialog control tables, dynamically populating a control box can give you greater flexibility in your installations. For instance, use the procedures in this article to dynamically populate other controls in your installations. This can make your installations more versatile and robust.
Subscribing will provide email updates when this Article is updated. Login is required to Subscribe
Thanks for your feedback. Let us know if you have additional comments below. (requires login)
This will clear the history and restart the chat.