Results 1 to 2 of 2

Thread: RegEnumValue Problems

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 1999
    Location
    Hamilton, New Zealand
    Posts
    137

    RegEnumValue Problems

    Hi, I cant' seem to get RegEnumValue to work, i'm just trying to get a list of all the string values in a particular key. Can anybody tell me whats wrong with the code below?

    It always dies on the RegEnum Value call

    Code:
    Public Function GetAllStrValues(hKey As Long, strPath As String) As Variant
    ' Returns: an array in a variant of strings
    
    Dim lRegResult As Long
    Dim lCounter As Long
    Dim hCurKey As Long
    Dim strBuffer As String
    Dim lDataBufferSize As Long
    Dim strNames() As String
    Dim intZeroPos As Integer
    
    'Open a new key
    Debug.Print RegOpenKey(hKey, strPath, hCurKey)
    lCounter = 0
    Do
        'Create a buffer
        strBuffer = String(255, 0)
        'enumerate the values
        If RegEnumValue(hCurKey, lCounter, strBuffer, 255, 0, ByVal 0&, ByVal 0&, ByVal 0&) <> 0 Then Exit Do
        'pritn the results to the form
        Debug.Print StripTerminator(strBuffer)
        lCounter = lCounter + 1
    Loop
    'Close the registry
    RegCloseKey hCurKey
    
    End Function
    Any help much appreciated
    Regards

    Matt Brown
    Hamilton, NZ
    VB6 C++ in Visual Studio 6sp4
    VB.net Beta 1

  2. #2
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    check your other thread...

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