|
-
Jan 10th, 2008, 06:59 AM
#1
Thread Starter
Hyperactive Member
[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
-
Jan 10th, 2008, 07:45 AM
#2
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:
chaveRoot = "HKEY_CURRENT_USER"
ChaveNome = "Software\Microsoft\Internet Explorer\PageSetup"
MsgBox GetKeyValue(HKEY_CURRENT_USER, ChaveNome, "header")
-
Jan 10th, 2008, 09:01 AM
#3
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|