Reading all values in a registry subkey
Hi All,
Can someone please show me how to read all values in a subkey at one time.
I'm creating a Startup Monitor program.
It uses a timer that fires every 100 milliseconds
When the program starts up I need it to read in the current values of a subkey into a textbox.
Then the timer fires and continuously reads the values in the same subkey into a second text box
Then the remaining code compares the two textboxes contents.
If there's any difference a message will appear informing the user that something has been changed.
example:
I need to read in all of the values in the:
HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run
subkey
All the reg code I have now can do everything except what I'm needing.
Here's what I have so far.
Private Sub Check1_Click()
Text1.Text = getstring(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run", _
"Site Surfer")
Timer1.Enabled = True
End Sub
This only reads in the value data from the single value Site Surfer
So is there a way to read in all values in a subkey into a textbox at one time?
Thanks,
techsent
Re: Reading all values in a registry subkey
Quote:
Originally Posted by MarkT
With the attached module and some code like this you can get there. I have used list box instead of a text box but I assume you can switch it to fit your needs.
VB Code:
Private Sub Form_Load()
Dim RegArray() As String
Dim intLoop As Integer
RegArray = EnumKeyValues(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run")
For intLoop = 0 To UBound(RegArray)
List1.AddItem RegArray(intLoop)
Next intLoop
End Sub
Many thanks for sharing this useful code.If i only want to output the following registery information how i can modify RegArray so that it displays the same registery information as the following shell function code:
Regedit.exe /e " & Chr(34) & Path & Chr(34) & " " & Chr(34) & _
"HKEY_CURRENT_USER" & "\" & "Software\panda\" & Chr(34))
i use this bold code to write registery values in to a file but i find your method better to display it in listbox so i be happy if u tell me how i can modify RegArray so that it outputs the same result as the bold code.
I tried :
RegArray = EnumKeyValues(HKEY_CURRENT_USER, "Software\panda\")
And it printed only the name not the data and type .Furthermore, it does not display the name and data and type for all folders inside Software\panda\ . (in another word i am not geting the full tree).There are many folders inside that and it only prints name for one of the folder!! I be happy if u help me here.Thanks