I'm trying to find out what subkey's exist for "HKEY_CURRENT_USER\Software\Microsoft\Outlook Express"
The result (singular) that should be returned is "5.0" but I'm getting blanks (literally, Chr(0)'s). I'm using the following code:
If I debug.print GetKeyName, I get lots of chr(0)'s and nothing else.
I'm not too au-fait with registry access through API's, so any help where I'm going wrong would be appreciated.
(NB, The function is called with GetKeyName(HKEY_CURRENT_USER, sKeyName, 0), all constants are publically declared.)
Many Thanks,
Si
------------------------
Hit any User to continue
The result (singular) that should be returned is "5.0" but I'm getting blanks (literally, Chr(0)'s). I'm using the following code:
Code:
Private Function GetKeyName(hInKey As Long, ByVal subkey As String, dwIndex As Long) As Variant
'
' Code courtesy of Terry Kreft, January 1998
'
'
Dim hKey As Long
Dim lpName As String
Dim lpcbName As Long
Dim lpReserved As Long
Dim lpClass As String
Dim lpcbClass As Long
Dim lpftLastWriteTime As FILETIME
Dim lngRet As Long
Dim hSubKey As Long
Const ERROR_SUCCESS As Long = 0
Const REG_SZ As Long = 1
hKey = RegOpenKeyEx(hInKey, subkey, 0, KEY_ALL_ACCESS, hSubKey)
If hKey <> ERROR_SUCCESS Then
Exit Function
End If
lpcbName = 256
lpName = String(lpcbName, 0)
lpReserved = 0
lpClass = String(1, 0)
lpcbClass = 0
lngRet = RegEnumKeyEx(hSubKey, dwIndex, lpName, lpcbName, lpReserved, lpClass, lpcbClass, lpftLastWriteTime)
GetKeyName = Left(lpName, lpcbName)
End Function
If I debug.print GetKeyName, I get lots of chr(0)'s and nothing else.
I'm not too au-fait with registry access through API's, so any help where I'm going wrong would be appreciated.
(NB, The function is called with GetKeyName(HKEY_CURRENT_USER, sKeyName, 0), all constants are publically declared.)
Many Thanks,
Si
------------------------
Hit any User to continue