|
-
Mar 25th, 2000, 10:32 PM
#1
Thread Starter
Junior Member
Hello!
I've a problem with the 'RegEnumKey'-Function. The function succeeds(it returns 0) but the third parameter(which returns the name of the subkey) is always empty!
VB 6.0; VC++ 6.0; PERL; PASCAL; BASIC; PHP4; HTML; mySQL
-
Mar 26th, 2000, 06:00 AM
#2
Lively Member
Hello,
I hope this code helps you but I'm in a bit of a rush at the moment so I haven't checked it through correctly. Just add a command button to a form and paste the code in.
Code:
Option Explicit
Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegEnumKey Lib "advapi32.dll" Alias "RegEnumKeyA" (ByVal hKey As Long, ByVal dwIndex As Long, ByVal lpName As String, ByVal cbName As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Const HKEY_CURRENT_USER = &H80000001
Private Sub Command1_Click()
GetAllSubKeys
End Sub
Function GetAllSubKeys()
Dim lResult As Long
Dim lRegKey As Long
Dim sBuff As String
Dim lBuffSize As Long
Dim lValue As Long
lResult = RegOpenKey(HKEY_CURRENT_USER, "RemoteAccess\Profile", lRegKey)
If lResult <> 0 Then Exit Function
lValue = 0
sBuff = Space(255)
lBuffSize = 255
While RegEnumKey(lRegKey, lValue, sBuff, lBuffSize) = 0
Debug.Print Left(sBuff, lBuffSize)
sBuff = Space(255)
lBuffSize = 255
lValue = lValue + 1
Wend
lResult = RegCloseKey(lRegKey)
End Function
Hope it helps,
Desire
-
Mar 26th, 2000, 08:02 PM
#3
Thread Starter
Junior Member
Yes, your code really helped me. Thank you!!
VB 6.0; VC++ 6.0; PERL; PASCAL; BASIC; PHP4; HTML; mySQL
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|