Apr 7th, 2005, 05:21 AM
#1
Thread Starter
Addicted Member
Registry Problem
i used the registry functions provided below, the problem is when i write the registry it writes it but when i try to find it in the regedit it doesn't display it ? how come that be possible
VB Code:
Public Function Registry_Read(Key_Path, Key_Name) As Variant
On Error Resume Next
Dim Registry As Object
Set Registry = CreateObject("WScript.Shell")
Registry_Read = Registry.RegRead(Key_Path & Key_Name)
End Function
Public Sub Registry_Write(Key_Path As String, Key_Name As String, Key_Value As Variant, Optional Key_Type As String)
On Error Resume Next
Dim Registry As Object
Dim Registry_Value As Variant
Set Registry = CreateObject("WScript.Shell")
Registry_Value = Registry_Read(Key_Path, Key_Name)
If Key_Type = "" Then
'REG_SZ is the default.
Registry.RegWrite Key_Path & Key_Name, Key_Value
Else
Registry.RegWrite Key_Path & Key_Name, Key_Value, Key_Type
End If
End Sub
Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water
Huzefa Yousuf
Software Engineer
Verticity Inc.
+92-345-2235303
[email protected]
Apr 7th, 2005, 05:45 AM
#2
Addicted Member
Re: Registry Problem
Are you actually declaring where abouts in the registry u are writing to??
Apr 7th, 2005, 05:47 AM
#3
Thread Starter
Addicted Member
Re: Registry Problem
yes i try to write the registry then read with the help of declared functions, it provides the accurate value but still it doesnt show in the regedit neither ne other application can access that registry
Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water
Huzefa Yousuf
Software Engineer
Verticity Inc.
+92-345-2235303
[email protected]
Apr 7th, 2005, 06:02 AM
#4
Re: Registry Problem
Hey, isn't that my code from PSC?
Apr 7th, 2005, 06:18 AM
#5
Thread Starter
Addicted Member
Re: Registry Problem
yeah it is ... but i can't get it to work... help me man !
Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water
Huzefa Yousuf
Software Engineer
Verticity Inc.
+92-345-2235303
[email protected]
Apr 7th, 2005, 11:25 PM
#6
Thread Starter
Addicted Member
Re: Registry Problem
well if u guys can't solve this prb then tell me other ways to write registry
Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water
Huzefa Yousuf
Software Engineer
Verticity Inc.
+92-345-2235303
[email protected]
Apr 7th, 2005, 11:36 PM
#7
Re: Registry Problem
This includes the module that does it:
Enjoy
Attached Files
Apr 7th, 2005, 11:39 PM
#8
Re: Registry Problem
I hope these helps....
SaveSetting:
VB Code:
' Place some settings in the registry.
SaveSetting appname := "MyApp", section := "Startup", _
key := "Top", setting := 75
SaveSetting "MyApp","Startup", "Left", 50
' Remove section and all its settings from registry.
DeleteSetting "MyApp", "Startup"
GetSetting:
VB Code:
Dim MySettings As Variant
' Place some settings in the registry.
SaveSetting "MyApp","Startup", "Top", 75
SaveSetting "MyApp","Startup", "Left", 50
Debug.Print GetSetting(appname := "MyApp", section := "Startup", _
key := "Left", default := "25")
DeleteSetting "MyApp", "Startup
SaveAllSetting:
VB Code:
' Variant to hold 2-dimensional array returned by GetAllSettings
' Integer to hold counter.
Dim MySettings As Variant, intSettings As Integer
' Place some settings in the registry.
SaveSetting appname := "MyApp", section := "Startup", _
key := "Top", setting := 75
SaveSetting "MyApp","Startup", "Left", 50
' Retrieve the settings.
MySettings = GetAllSettings(appname := "MyApp", section := "Startup")
For intSettings = LBound(MySettings, 1) To UBound(MySettings, 1)
Debug.Print MySettings(intSettings, 0), MySettings(intSettings, 1)
Next intSettings
DeleteSetting "MyApp", "Startup"
DeleteSetting:
VB Code:
' Place some settings in the registry.
SaveSetting appname := "MyApp", section := "Startup", _
key := "Top", setting := 75
SaveSetting "MyApp","Startup", "Left", 50
' Remove section and all its settings from registry.
DeleteSetting "MyApp", "Startup"
Apr 7th, 2005, 11:40 PM
#9
Re: Registry Problem
Attached Files
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