PDA

Click to See Complete Forum and Search --> : Registry HKEY_LOCALE_MACHINE


R@emdonck
Jan 12th, 2000, 04:31 PM
Hi,

Can somebody please write me a code example how to save a value in the registry but, it has to be located in the HKEY_LOCALE_MACHINE section.

About the example:

this is how it should look like:

HKEY_LOCALE_MACHINE

MainFolder

SubFolder

Value


Thanks R@emdonck

[This message has been edited by R@emdonck (edited 01-13-2000).]

michelle
Jan 12th, 2000, 05:37 PM
I do think this is not what you are searching for, but me it will helps you further.


RegisterName = "New"
Sav = "This is a test"
YourPath = "Users\yours"

SaveSetting "Logon Master", YourPath, RegisterName, Sav
ReGi = GetSetting("Logon Master", YourPath, RegisterName, "X")
DeleteSetting "Logon Master", YourPath, RegisterName


Nice regards,

Michelle.

R@emdonck
Jan 13th, 2000, 01:15 AM
HELP ME ...

Aaron Young
Jan 13th, 2000, 01:54 AM
You can't create a Registry Entry Directly off the Root of HKEY_LOCAL_MACHINE it has to come off of one of the Subkeys, ie. Software, eg.

Private Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Private 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


------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
ajyoung@pressenter.com