|
-
Nov 6th, 2005, 09:53 AM
#1
Thread Starter
Hyperactive Member
Get rigistry value from outsite of VB and VBA Programing
hi, i am trying to get and change a string from outsite HKEY_CURRENT_USER\Software\VB and VBA Programming\
as in somewhere like HKEY_USERS\.DEFAULT\Controll Pannel\Desktop\ or somewhere. i know of getsetting and savesetting but i can not get them to work with anything outsite of the VB and VBA Programming Key. What can i use the get and change a string value from outside of VB and VBA Prog.. Key?
thanks, dandono.
If there is only one perfect person in the universe, does that make them imperfect?
-
Nov 6th, 2005, 10:00 AM
#2
Re: Get rigistry value from outsite of VB and VBA Programing
I think this is a FAQ submission candidate (unless it exists... did you check? )
Do a forum search for "registry" and you will find umpteen examples
-
Nov 6th, 2005, 10:23 AM
#3
Thread Starter
Hyperactive Member
Re: Get rigistry value from outsite of VB and VBA Programing
i found umpteen examples of the GetSetting and SaveSetting method that does not do anything outside of VB and VBA Prog.. Key. I found this thread
 Originally Posted by Joacim Andersson
Yes you can get it to save your settings under any key in the registry but not without using the registry API functions. The GetSetting and SaveSetting functions only work on the above mentioned key.
so i guess i need to search for the registry API now
ps: i did do a forum search but only searched a few pages
If there is only one perfect person in the universe, does that make them imperfect?
-
Nov 6th, 2005, 10:31 AM
#4
Re: Get rigistry value from outsite of VB and VBA Programing
-
Nov 6th, 2005, 11:01 AM
#5
Thread Starter
Hyperactive Member
Re: Get rigistry value from outsite of VB and VBA Programing
VB Code:
Option Explicit
Dim reg As cRegistry
Private Sub SaveSettings() 'Writes to Registry
Set reg = New cRegistry
'This will create a new value in the Run section
'so your program will automatically run when Windows starts
'This will create a new section to store your own keys in
reg.ClassKey = HKEY_USERS
reg.SectionKey = ".DEFAULT\Control Panel\Desktop"
reg.ValueKey = "Wallpaper"
reg.ValueType = REG_SZ
reg.Value = CLng(Text2.Text)
End Sub
Private Sub GetSettings() 'Reads the Registry
Set reg = New cRegistry
reg.ClassKey = HKEY_USERS
reg.SectionKey = ".DEFAULT\Control Panel\Desktop"
reg.ValueKey = "Wallpaper"
End Sub
Private Sub Form_Load()
Call GetSettings
Text1.Text = reg.Value
End Sub
Private Sub Form_Unload(Cancel As Integer)
SaveSettings
End Sub
vbruntime error 13
If there is only one perfect person in the universe, does that make them imperfect?
-
Nov 6th, 2005, 11:05 AM
#6
Re: Get rigistry value from outsite of VB and VBA Programing
That's not very helpful, where does the error occur.
-
Nov 6th, 2005, 11:06 AM
#7
Thread Starter
Hyperactive Member
Re: Get rigistry value from outsite of VB and VBA Programing
If there is only one perfect person in the universe, does that make them imperfect?
-
Nov 6th, 2005, 11:08 AM
#8
Re: Get rigistry value from outsite of VB and VBA Programing
What exact line does it break upon, and what is highlighted?
-
Nov 6th, 2005, 12:09 PM
#9
Thread Starter
Hyperactive Member
Re: Get rigistry value from outsite of VB and VBA Programing
the line with
VB Code:
reg.Value = CLng(Text2.Text)
in the SaveSettings function
If there is only one perfect person in the universe, does that make them imperfect?
-
Nov 6th, 2005, 09:30 PM
#10
Re: Get rigistry value from outsite of VB and VBA Programing
Don't use CLng(). If the key type is REG_SZ it means a string, and you're trying to convert it to a Long instead.
-
Nov 27th, 2005, 08:27 AM
#11
Thread Starter
Hyperactive Member
Re: Get rigistry value from outsite of VB and VBA Programing
If there is only one perfect person in the universe, does that make them imperfect?
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
|