jmaerten
16th February 2006 15:06 UTC
Read Registry keys into listbox
I have several registry keys within one registry key, and I would like these keys to be put into a listbox that is used in the installation. For example I would have:
HKLM SOFTWARE\MySoftware\cat
HKLM SOFTWARE\MySoftware\dog
HKLM SOFTWARE\MySoftware\rooster
HKLM SOFTWARE\MySoftware\elephant
So, in my listbox I would want the items: cat, dog, rooster, and elephant. This is because these keys have unique directory values that choose where the install directory should be.
Please note: I would like this without using the registry plugin if possible. I don't know if ReadRegStr can read keys instead of just values.
Thanks for your help!
dienjd
16th February 2006 16:29 UTC
Have you tried EnumRegKey?
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.2 (4.9.2.5). Seems like you can use this to enumerate your subkeys and then parse off everything before the final "\" to get the subkey name itself.
jmaerten
16th February 2006 22:00 UTC
Using that function worked, thanks for your help.
But, I still need help figuring out which item was selected. I am looking at the ListBox example, but I can't figure it out yet. In my ini file, the "Field 2" is the listbox. I want to disable the next button until an item is selected. Once it is selected, I want to be able to use it (ie. stored in a global variable) If anyone can tell me the code to do this I'd greatly appreciate it.
Afrow UK
17th February 2006 09:18 UTC
If you want to keep it simple you can try my PopupListBox plugin at http://nsis.sf.net/File:PopupListBox.zip
I'm also releasing an EmbeddedListBox plugin which is like an IO page except you can have a multicolumn list view with headings (report view) and optionally with checkboxes as well.
-Stu
RobGrant
17th February 2006 11:18 UTC
It might be easier to keep the next button enabled, but just abort the leave function if they haven't selected anything.
To find out what they've selected, just use:
Push $0
!insertmacro MUI_INSTALLOPTIONS_READ $0 "ininame.ini" "Field 1" "State"
Where your ini is called ininame.ini, and your list is in Field 1.
jmaerten
17th February 2006 16:56 UTC
Thanks
Thanks for all your help.
Everything is working great now.