Results 1 to 4 of 4

Thread: Registry HKEY_LOCALE_MACHINE

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Location
    Belgium
    Posts
    98

    Post

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

  2. #2
    Hyperactive Member
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    455

    Post

    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.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Location
    Belgium
    Posts
    98

    Post

    HELP ME ...

  4. #4
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    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.
    Code:
    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
    [email protected]
    [email protected]


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width