CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 1998
    Posts
    5

    Registry Gurus Please Help Me!



    Hi frineds,

    I would like to enumerate all the keys under HKEY_CLASSES_ROOT\CLSID\

    and put them in a collection or variant array .

    Can any one help me with the code how to achieve it?

    Afterwards i would like to traverse the collection using "for each next" and do

    my own stuff on that.

    If any one knows how to use the API RegEnumValue() in a loop so that

    i can enumerate all the keys under HKEY_CLASSES_ROOT\CLSID\, pl tell me.

    If possible please help me with the sample code in VB.

    Thanking you.

    With Regards

    pavan

  2. #2
    Join Date
    Feb 1999
    Posts
    3

    Re: Registry Gurus Please Help Me!

    Hello

    You can use a code similar to the one below, this function will return an array of keys;

    Public Function RegEnumKey(HandleToKeyToEnumerate As Long)
    Dim lResult As Long
    Dim lCurIdx As Long
    Dim strValue As String
    Dim lLenOfData As Long
    Dim strClass As String
    Dim lClassLen As Long
    Dim lFileTime As FILETIME
    Dim aResult() As String

    lCurIdx = 0
    Do
    lLenOfData = 256
    strValue = String(lLenOfData, 0)
    lClassLen = 256
    strClass = String(lClassLen, 0)

    lResult = RegEnumKeyEx(HandleToKeyToEnumerate, _
    lCurIdx, _
    ByVal strValue, _
    lLenOfData, _
    0&, _
    ByVal strClass, _
    lClassLen, _
    lFileTime)

    If lResult = ERROR_SUCCESS Then
    ReDim Preserve aResult(lCurIdx)
    aResult(lCurIdx) = Left$(strValue, lLenOfData)
    End If
    lCurIdx = lCurIdx + 1

    Loop While lResult = ERROR_SUCCESS
    RegEnumKey = aResult
    End Function


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

Featured