svejdo1
Posts: 4
Joined: Wed Jul 11, 2007 3:20 pm
Location: Czech Republic
Contact: Website

fill combobox

Is there a way to dynamically fill combobox from .NET custom action or from C++ dll custom action ? I cannot use vbs custom actions because they are blocked by agressive anti-virtus software on some customer computers.

Regards,
Ondrej
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Hi Ondrej,

You can populate a Combobox or Listbox control from an Immediate Custom Action. This means that you can use only a C++ DLL Custom Action, not a .NET CA.

Basically, the steps are the following:

1. Construct the query string (INSERT INTO `ComboBox` ...):
http://msdn2.microsoft.com/en-us/librar ... S.85).aspx

2. Obtain the handle for the active database using MsiGetActiveDatabase:
http://msdn2.microsoft.com/en-us/librar ... S.85).aspx

3. Create a view object using MsiDatabaseOpenView, specifying the query string you have constructed previously:
http://msdn2.microsoft.com/en-us/librar ... S.85).aspx

4. Execute the SQL query on the view object using the MsiViewExecute function:
http://msdn2.microsoft.com/en-us/librar ... S.85).aspx

5. Close any open handles using MsiCloseHandle if you are not using the PMSIHANDLE wrapper class.

The following forum threads provide VBScript Custom Actions for achieving what you want and might prove useful:
http://www.advancedinstaller.com/forums ... php?t=4636
http://www.advancedinstaller.com/forums ... php?t=1768

In a future AI version we shall consider adding predefined Custom Actions that insert items in a Combobox or Listbox control.

Hope this helps.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/
Ionut
Posts: 605
Joined: Tue Nov 22, 2005 11:29 am
Contact: Website

Predefined CAs for working with ComboBox and ListBox control

Hi,

Starting with version 6.3, AI includes predefined Custom Actions for populating, deleting from and extracting data from ComboBox and ListBox controls.

You will find a tutorial and sample projects in the AI help file or online user guide.

For any questions or comments do not hesitate to contact us at support at advancedinstaller dot com.

Regards,
Ionut
Denis Toma
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”