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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading from Registry!

Status
Not open for further replies.

WidowMaker

IS-IT--Management
Jun 30, 2001
12
0
0
DK
Hey All,
I wonder if you can help me with this:
I would like to read from the Registry, either (or both) all SubKeys or (/and) all Values in a Key, and return these as Variables! ThnX for you input!

Ex1:
HKLM\SOFTWARE\TEST
HKLM\SOFTWARE\TEST\KEY1\SOMEVALUE
HKLM\SOFTWARE\TEST\KEY2\SOMEVALUE

Returns KEY1 and KEY2

Ex2:
HKLM\SOFTWARE\TEST
HKLM\SOFTWARE\TEST\KEY1\SOMEVALUE1
HKLM\SOFTWARE\TEST\KEY1\SOMEVALUE2

Returns SOMEVALUE1 and SOMEVALUE2

 
Hello, W_Maker.

As wchull has said, one solution is to install the MS' own ActiveX control RegObj.dll. My note here sticks to this line of solution only.

RegObj.dll is unfortunately not a free download. MS requires you be a VB licensee in order to get it download for free at :


Also, it is delivered within the package of Office 2000. I am aware also that there is/are book(s) with it as a token.

I don't think you can get a free download from C. Washington's site, not that I know of.

The functionality needed is to return an enumerate collection of all the subkeys and/or entries under a key. The WScript.Shell does not support this method. Whereas, with RegObj.dll registered, it supports a method RegObj.Registry.RegKeyFromString which does exactly that.

As a generic application with that method, I had made a posting previously in enumerating all the programs appeared in Add/Remove Programs applet at the Control Panel :

thread329-112415

May be you can take a look at it.

regards - tsuji
 
There seems to be a mem leak in RegObj.DLL. Try this code:
Dim oReg As New Registry
Dim sTemp As String
Dim oRegKey As RegKey

Set oRegKey = oReg.RegKeyFromString("\HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System")

sTemp = oRegKey.Values("Identifier")


Set oRegKey = Nothing
Set oReg = Nothing
sTemp = ""

It will leak badly.

Any one got any workarounds?

Jay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top