Link to home
Start Free TrialLog in
Avatar of lamer
lamer

asked on

Enumerate through an hkey's StringValue and Name.

Knowing that i already have a key at
HKEY_LOCAL_MACHINE
   -> SOFTWARE
         -> MYSOFTWARENAME
                  ->MYSETTINGS
                           -Setting1 = "1234567"
                           -Setting2 = "aaaaaaa"


how do i enumurate thorugh MYSETTINGS to get all the available setting information. Since I do not know how many Settings they are in MySettings and I do not know what the Key and also the value is?

it could be Setting1, it could be SettingAAA etc.


Some code samples would help, ive tried playing around with RegEnumKey RegEnumValue and RegQueryalue and its associated functions but I can't seem to get it to work... it wont even compile right becoz i dun really know how to pass in some of its function parameters... im still pretty new in VC++ so workable code samples would really really help...

ive looked thorugh code guru and most of the samples are for extracting values where u already know the HKEY to look for... and in my case i do not..

so lotsa help needed... regards

lamer,
ASKER CERTIFIED SOLUTION
Avatar of snoegler
snoegler

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
Avatar of lamer
lamer

ASKER

What u did missed something..
I still do now know how to get the Value of the the Leafs..

by using RegQueryValueEx I managed to return the default value for the 1st leaf.

But not for my other leafs. Although i can enumrate through the list of leafs and return its name.

Are u telling me that the only option is to ReOpen the Registry with a new Key which is the leaf as the subkey and call RegQueryKeyEx until all the leafs are enumerated?

thanx
Avatar of lamer

ASKER

What u did missed something..
I still do now know how to get the Value of the the Leafs..

by using RegQueryValueEx I managed to return the default value for the 1st leaf.

But not for my other leafs. Although i can enumrate through the list of leafs and return its name.

Are u telling me that the only option is to ReOpen the Registry with a new Key which is the leaf as the subkey and call RegQueryKeyEx until all the leafs are enumerated?

thanx
Avatar of lamer

ASKER

Nvermind.. solved it...
apparently u need to call RegQueryValEx
twice!!!

1) to get the size and the type
2) to get the Value..