Link to home
Start Free TrialLog in
Avatar of urivera
urivera

asked on

How to get (iterate) through the subkeys in the registry

Hello,

I need to know how to iterate or get the names of subkeys located in a specific location in the registry. For example, I created several keys in the software folder in the registry under HKEY_CURRENT_USER

SOFTWARE\\MycompanyName\\MyCompanySoftwareName\\SavedSettings\\

I created the MyCompanyName, MyCompanySoftwareName, SavedSettings keys, under the SavedSettings I will also create other keys, I need a way to go through all the keys in under SavedSettings so I can display the name of the keys in a listbox control in a dialog.
Avatar of AlexFM
AlexFM

See RegEnumKeyEx function.
Avatar of urivera

ASKER

Any way of using CRegKey instead?  I saw on msdn that there is a EnumKey method but when try to use it compiler complains it can't find the method, although it can find open, create, and other methods.  I wanted to use a CRegKey object because I already started using it in the code.
HI Univera
     CRegKey doesn't provide support for Enumerating the Key,but you can use Registry handle from CRegKey object to enum key using RegEnumKey(...) api.

 if you like ,i can post a samll example dealing with both!!!!

Avatar of urivera

ASKER

Hi Cool_alok,

Can you please post an example?

thanks
ASKER CERTIFIED SOLUTION
Avatar of cool_alok
cool_alok

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial