megabyte214
Programmer
Hello, I am teaching myself API calls with Dan Appleman's WIN32 API Guide. I am trying to open a registry key and get a handle to the key and then enumerate through the values to get the CLSID value. Thanks in advance.
Code:
Option Explicit
Dim lpSubKey As String
Dim result As LoadPictureColorConstants
Dim hKey As Long, Cnt As Long, sName As String, sData As String, Ret As Long, RetData As Long
Const BUFFER_SIZE As Long = 255
Dim x As myDLL.Class1
Private Sub Form_Load()
RegOpenKey hKey, x, result
While RegEnumKeyEx(hKey, Cnt, sName, Ret, ByVal 0&, vbNullString, ByVal 0&, ByVal 0&) <> ERROR_NO_MORE_ITEMS
'Show the enumerated key
Me.Print " " + Left$(sName, Ret)
'prepare for the next key
Cnt = Cnt + 1
sName = Space(BUFFER_SIZE)
Ret = BUFFER_SIZE
Wend
'close the registry key
RegCloseKey hKey
End Sub