Results 1 to 3 of 3

Thread: [RESOLVED] read/write registry

  1. #1

    Thread Starter
    Hyperactive Member RS_Arm's Avatar
    Join Date
    Mar 2007
    Location
    Planet Earth
    Posts
    282

    Resolved [RESOLVED] read/write registry

    Hello. After some search here in vbforum, I decided to use the file "Microsoft Visual Studio\VB98\Template\Code\Registry Access.bas" to read and write values from/to registry.

    But I just can't find any simple example for it.
    So, I want t read a value from "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup\header"

    I've done this:
    Code:
    Private Sub Command1_Click()
    Dim chaveRoot As String, ChaveNome As String
    Dim chave As String
    Dim x As Variant
    
    
    chave = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup\header"
    
    chaveRoot = "HKEY_CURRENT_USER"
    ChaveNome = "Software\Microsoft\Internet Explorer\PageSetup\header"
    
    x = AcessoReg.GetKeyValue(HKEY_CURRENT_USER, ChaveNome, "")
    
    MsgBox x
    End Sub
    I'm not getting any value from this key.
    What am I missing?

    Thank you

  2. #2
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: read/write registry

    The last parameter of GetKeyValue needs the ValueName. You also need to remove it from the 2nd parameter. ie:
    vb Code:
    1. chaveRoot = "HKEY_CURRENT_USER"
    2. ChaveNome = "Software\Microsoft\Internet Explorer\PageSetup"
    3.  
    4. MsgBox GetKeyValue(HKEY_CURRENT_USER, ChaveNome, "header")

  3. #3

    Thread Starter
    Hyperactive Member RS_Arm's Avatar
    Join Date
    Mar 2007
    Location
    Planet Earth
    Posts
    282

    Re: read/write registry

    Ok, thank you very much.
    Now it is working.

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