PDA

Click to See Complete Forum and Search --> : HKEY_LOCAL_MACHINE (part 2)


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).]

R@emdonck
Jan 16th, 2000, 03:04 PM
HELP, HELP, HELP, HELP, HELP, HELP, ...

Joacim Andersson
Jan 16th, 2000, 04:05 PM
Read Johns article (http://www.vb-world.net/articles/registry2) about it.

------------------
Joacim Andersson
joacim@programmer.net
joacim@yellowblazer.com
www.YellowBlazer.com (http://www.YellowBlazer.com)

Maartin
Jan 16th, 2000, 05:33 PM
R@emdonck.

Download the file named regobj.exe from the URL,http://www.freedrive.com/ASP/PostFolderShortcut.asp?fsc=2940490.

This is a self-extracting file so just run it and read the instructions on screen.

Hope it will help you.


------------------
-----------------------
Maartin
dinamite@onwe.co.za
-----------------------