Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Playing with Registry API's

Status
Not open for further replies.

megabyte214

Programmer
Nov 7, 2001
40
US
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 &quot; &quot; + 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
 
MSDN recommends use of RegOpenKeyEx as RegOpenKey is only for 16-bit compatibility.

Have you set the values for hKey, x, result elsewhere? Let me know if this helps
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top