Results 1 to 5 of 5

Thread: Registry

  1. #1

    Thread Starter
    Lively Member Gherkin's Avatar
    Join Date
    Aug 2001
    Location
    Gherkin Land
    Posts
    65

    Registry

    Hi!

    I would like to load into a array (or listbox) all the sub-keys of a registry key.

    For example:

    I would use HKEY_CLASSES_ROOT\.bmp\ and it would load all subkeys like ShellNew, OpenWithList, etc. The I would like to be able to get the default value of HKEY_CLASSES_ROOT\.bmp\ShellNew .

    If this sounds confusing, tell me and I'll try to explain better.

    Thanks a lot!

  2. #2
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    The EnumRegKey function of the attached module returns all the sub keys of the key specified. There are commented examples of each function that you can modify to your needs.

    This module is just a slight rework of one that lordrat posted.
    Attached Files Attached Files

  3. #3

    Thread Starter
    Lively Member Gherkin's Avatar
    Join Date
    Aug 2001
    Location
    Gherkin Land
    Posts
    65
    Hi!

    I can't get it to work!!!

    Can you explain?

    I have VB5.

    Thanks!

  4. #4
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    Since I not really sure if you are trying to get all the values of a key or all the sub keys of a key, I'm showing you both. I would guess this should also work with VB5.

    For this example place 2 listboxes on the form and add this code. I have given you examples that should probably produce results on your machine and I have also written in (and commented) what I think you may be looking for.
    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Load()
    4. Dim RegArray() As String
    5. Dim intLoop As Integer
    6.  
    7.     On Error Resume Next    '   in case the array returns nothing
    8.  
    9. '   Get sub keys
    10.     RegArray = EnumRegKey(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Explorer")
    11. '    RegArray = EnumRegKey(HKEY_CURRENT_USER, ".bmp")
    12.    
    13.     For intLoop = 0 To UBound(RegArray)
    14.         List1.AddItem RegArray(intLoop)
    15.     Next intLoop
    16.    
    17. '   Get values of key
    18.     RegArray = EnumKeyValues(HKEY_LOCAL_MACHINE, "Software\Microsoft\Windows\CurrentVersion\Run")
    19. '    RegArray = EnumKeyValues(HKEY_CURRENT_USER, ".bmp")
    20.    
    21.     For intLoop = 0 To UBound(RegArray)
    22.         List2.AddItem RegArray(intLoop)
    23.     Next intLoop
    24. End Sub

  5. #5

    Thread Starter
    Lively Member Gherkin's Avatar
    Join Date
    Aug 2001
    Location
    Gherkin Land
    Posts
    65
    I got it to work!

    Thanks for all your help!

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