Debstep
Posts: 2
Joined: Fri May 23, 2008 7:45 pm

enumerate items from ComboBox into the registry

I am new to advanced Installer and I am working through the various examples. i really like the sample Combo and Listbox dialog example in 6.3.
the listbox returns a | separated list of items in the MY_LISTBOX property How would I enumerate that list during the install to create a new registry value for each item in that list ? can I add the data values at the same time?
thanks for any help
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: enumerate items from ComboBox into the registry

Hi,
How would I enumerate that list during the install to create a new registry value for each item in that list ?
The best approach is to write the values in the registry like they are kept in the AI_LISTBOX_DATA property. This way, the registry entry will be managed by Windows Installer and it will be parsed by your application.

However, if you want to create a registry entry for each value in the AI_LISTBOX_DATA property you can use the Split() function. This function allows you to parse the value of the property inside the custom action. With this approach you will gain access to all the values in the AI_LISTBOX_DATA property which are separated by the "|" character. These values can be written directly in the registry or they can be placed into properties that are used by registry entries.

Note that a registry entry created by a custom action is not managed by Windows Installer. Therefore, an uninstall will not remove a registry entry created by a custom action. Also, the values you mentioned are always written in the AI_LISTBOX_DATA property, not in MY_LISTBOX.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Debstep
Posts: 2
Joined: Fri May 23, 2008 7:45 pm

Re: enumerate items from ComboBox into the registry

Thank you for your reply, Cosmin.
I was hoping to have the Windows installer manage the registry keys but since I cannot predict the number of items that will eventually be in the AI_LISTBOX_DATA property, and I don't think there is a way to create a new property on the fly in an msi, then it looks like a custom action is my only choice. I suppose I may need to store that data as well for the reverse custom action in the event of a rollback ...I can dump the whole key in uninstall.
Anyway, thanks again

Return to “Common Problems”