I am trying to loop through a list of subkeys in the registry, but I am having no success. I am able to loop through string values using RegEnumValue, but RegEnumKeyEx is not working. Here is a copy of my code. What have I missed?
'NOTE: sFullPath = "Software\MyCompany\SwitchDB\Aliases"
mnlRetVal = RegOpenKeyEx(adhcnlhKey_LOCAL_MACHINE, sFullPath, 0, KEY_READ, mnlhKey)
'mnlhKey does contain a value at this point
For nlKeyIndex = 0 To 10
Call RegEnumKeyEx(mnlhKey, nlKeyIndex, sKeyName, nlKeyLength, Null, Null, Null, mtoLastMod)
Debug.Print "sKeyName= " & Trim(sKeyName)
'sKeyName is always empty
mnlRetVal = RegCloseKey(mnlhKey)