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