R@emdonck
Jan 15th, 2000, 11:58 AM
Hi,
I got this code from Aaron Young, and it works great. But ...
Can some tell me how to read a value from the registry in HKEY_LOCAL_MACHINE.
R@emdonck
Code:
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As LongPrivate Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As LongPrivate Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Sub Command1_Click()
Dim lRegKey As Long
If RegCreateKey(HKEY_LOCAL_MACHINE, "Software\Main Folder\Sub Folder", lRegKey) = 0 Then Call RegSetValue(lRegKey, "", 1, "Value", Len("Value"))
End If
If lRegKey Then Call RegCloseKey(lRegKey)
End Sub
[This message has been edited by R@emdonck (edited 01-16-2000).]
I got this code from Aaron Young, and it works great. But ...
Can some tell me how to read a value from the registry in HKEY_LOCAL_MACHINE.
R@emdonck
Code:
Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As LongPrivate Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As LongPrivate Declare Function RegSetValue Lib "advapi32.dll" Alias "RegSetValueA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
Private Const HKEY_LOCAL_MACHINE = &H80000002
Private Sub Command1_Click()
Dim lRegKey As Long
If RegCreateKey(HKEY_LOCAL_MACHINE, "Software\Main Folder\Sub Folder", lRegKey) = 0 Then Call RegSetValue(lRegKey, "", 1, "Value", Len("Value"))
End If
If lRegKey Then Call RegCloseKey(lRegKey)
End Sub
[This message has been edited by R@emdonck (edited 01-16-2000).]