Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Registry SubKeys

Status
Not open for further replies.

josephk73

Technical User
Aug 1, 2002
115
GB
I need to read a registry key and any/all the MAIN subkeys below the main key.

So for example if the main key is say HKLM\SYSTEM\, then I need to be able to enumerate ControlSet001, ControlSet002, CurrentControlSet ....etc. It is not necessary that I read the subkeys of the subkey (ie I do not need to perform recursive enumeration).

As the keys are being enumerated, I would like to store the values into an array, so that I can then do a search in the array for a specific value. Ideas anybody?
 
PHV,

You've done it again. Thanks.

Just one thing, I now have the subkeys in the array, but I now need to find a specific element in the returned array. I've looked in my VB book, but it dosent show any methods on how to query an array to find whether a specific element exists or not.

Any further help possible?
 
You can iterate the arry looking for the key of interest or instead of putting them in an array, put them in a dictionary and use the .Exists method.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
TomThumbKP

Thanks for your help, I've got it sorted now!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top