|
-
Feb 25th, 2006, 11:14 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Registry Read with API only?
How do I get a key's data using API's only? Thanks. (No WScript please)
Did you find a post in this thread useful? Please click Rate This Post.
-
Feb 26th, 2006, 12:57 AM
#2
Re: Registry Read with API only?
-
Feb 26th, 2006, 05:00 AM
#3
Re: Registry Read with API only?
Keys cant contain data. Only values can.
Or do you mean that you want to enumerate (list) all the values in a certain key?
-
Feb 26th, 2006, 08:38 PM
#4
Thread Starter
Fanatic Member
Re: Registry Read with API only?
I meant the values sorry.
Did you find a post in this thread useful? Please click Rate This Post.
-
Feb 27th, 2006, 07:30 PM
#5
Thread Starter
Fanatic Member
Re: Registry Read with API only?
Is there any other code I can use, because that one doesn't look like its using API.
Did you find a post in this thread useful? Please click Rate This Post.
-
Feb 27th, 2006, 08:46 PM
#6
Re: Registry Read with API only?
Heres all the code in a module.
-
Feb 27th, 2006, 08:47 PM
#7
Re: Registry Read with API only?
The link in my sig fully uses API
-
Feb 27th, 2006, 09:53 PM
#8
Thread Starter
Fanatic Member
Re: Registry Read with API only?
Oh I see how it works now, but how can I check if a key exists? I'm using the read function but I am confused, can you give me an example?
Did you find a post in this thread useful? Please click Rate This Post.
-
Feb 27th, 2006, 10:19 PM
#9
Re: Registry Read with API only?
Sure bro,
VB Code:
Private Function KeyExists(Hkey As String, Section As String, Valuekey As String) As Boolean
On Error Resume Next
Set Reg = New cRegistry
Reg.ClassKey = Hkey
Reg.SectionKey = Section
Reg.Valuekey = Valuekey
If Reg.Value <> Empty Then KeyExists = True
End Function
-
Feb 27th, 2006, 10:29 PM
#10
Re: Registry Read with API only?
Remix, seems to be a problem with the ShellAndFind(Hwnd) Link in your sig?
It should be:
http://www.vbforums.com/showthread.p...61#post2214161
Last edited by jcis; Feb 27th, 2006 at 10:55 PM.
-
Feb 27th, 2006, 10:46 PM
#11
Thread Starter
Fanatic Member
Re: Registry Read with API only?
I've Done this:
VB Code:
Call KeyExists(HKEY_LOCAL_MACHINE, "SOFTWARE\Mozilla\Mozilla Firefox 1.5\bin", "PathToExe")
Should I do this instead:
VB Code:
If KeyExists(HKEY_LOCAL_MACHINE, "SOFTWARE\Mozilla\Mozilla Firefox 1.5\bin", "PathToExe") Then
'Do Stuff
End If
Oh, and how can I read the value using the read thing? And save it to a string variable?
Did you find a post in this thread useful? Please click Rate This Post.
-
Feb 27th, 2006, 11:00 PM
#12
Re: Registry Read with API only?
Sorry, I meant to provide an explanation
VB Code:
Option Explicit
Dim reg As cRegistry
Private Sub Form_Load()
If KeyExists(HKEY_CURRENT_USER, "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer") = True Then
'Key exists
End If
Dim tReg As String
tReg = ReadReg(HKEY_CURRENT_USER, "SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer")
End Sub
Private Function KeyExists(Hkey As String, Section As String, Valuekey As String) As Boolean
On Error Resume Next
Set reg = New cRegistry
reg.ClassKey = Hkey
reg.SectionKey = Section
reg.Valuekey = Valuekey
If reg.Value <> Empty Then KeyExists = True
End Function
Private Function ReadReg(Hkey As String, Section As String, Valuekey As String) As String
Set reg = New cRegistry
reg.ClassKey = Hkey
reg.SectionKey = Section
reg.Valuekey = Valuekey
ReadReg = reg.Value
End Function
I think that should do it
-
Feb 27th, 2006, 11:02 PM
#13
Re: Registry Read with API only?
 Originally Posted by jcis
Thanks
-
Feb 27th, 2006, 11:09 PM
#14
Thread Starter
Fanatic Member
Re: Registry Read with API only?
Did you find a post in this thread useful? Please click Rate This Post.
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
|