Results 1 to 4 of 4

Thread: Reading all values in a registry subkey

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    SF
    Posts
    93

    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

  2. #2
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    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:
    1. Private Sub Form_Load()
    2. Dim RegArray() As String
    3. Dim intLoop As Integer
    4.  
    5.  RegArray = EnumKeyValues(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run")
    6.  
    7.  For intLoop = 0 To UBound(RegArray)
    8.      List1.AddItem RegArray(intLoop)
    9.  Next intLoop
    10.  
    11. End Sub
    Attached Files Attached Files

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    SF
    Posts
    93
    Thanks Mark!!! It works perfectly.

    Without your .bas I would still be spinning around the net trying to figure this out.

    Thanks again!

    Patrick

  4. #4
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    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:
    1. Private Sub Form_Load()
    2. Dim RegArray() As String
    3. Dim intLoop As Integer
    4.  
    5.  RegArray = EnumKeyValues(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run")
    6.  
    7.  For intLoop = 0 To UBound(RegArray)
    8.      List1.AddItem RegArray(intLoop)
    9.  Next intLoop
    10.  
    11. 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
    Last edited by tony007; Apr 10th, 2006 at 01:29 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width