|
-
Nov 23rd, 2009, 04:08 AM
#1
Thread Starter
Lively Member
[Help]Need help with Registry
Hi guys,
I am creating a project which needs to update/create/modify etc the registry. I am able to all the things, the problem in which i am stuck is that after editing Registry changed doesnot take place instantly i have to log off/log in to se changes to take place.
I am looking for a way to update the registry without logging off and on. Can any one help me.
Last edited by riteshtechie; Nov 23rd, 2009 at 05:49 AM.
-
Nov 23rd, 2009, 04:15 AM
#2
Re: [Help]Need help with Registry
I think you'll find that any changes you make to the Registry are immediate. Perhaps you're changing some seeting that are only read from the Registry by the OS at startup. For those to actually take effect you would have to log off and back on again, but the Registry should still contain the new information without that. If this doesn't seem to be the case, can you provide an example?
-
Nov 23rd, 2009, 04:23 AM
#3
Hyperactive Member
Re: [Help]Need help with Registry
I edit registry values as well, but they change instantly. Maybe I am using different methods? These are a few methods that I use:
OpenSubKey
vb Code:
Dim key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("Software\" & My.Application.Info.AssemblyName) With key .SetValue("Value", value, Microsoft.Win32.RegistryValueKind.Binary) .Close() End With or If key IsNot Nothing Then With key GUID = .GetValue("GUID") .Close End With End If
Note that I also call .Close on the registrykey. This maybe the reason that the key won't get updated instantly in your case.
SetValue
vb Code:
Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER\Software\" & My.Application.Info.AssemblyName, "Value", value)
GetValue
vb Code:
Microsoft.Win32.Registry.GetValue("HKEY_CURRENT_USER\Software\" & My.Application.Info.AssemblyName, "Value", value)
[EDIT]
More information on .Close : http://msdn.microsoft.com/en-us/libr...key.close.aspx
-
Nov 23rd, 2009, 04:59 AM
#4
Thread Starter
Lively Member
Re: [Help]Need help with Registry
Code:
Dim regKey As RegistryKey
Private Sub adv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles adv.Click
regKey = Registry.CurrentUser.OpenSubKey("Software\Policies\Microsoft\Internet Explorer\Control Panel", True)
If adv.Text = "Hide" Then
regKey.SetValue("AdvancedTab", 1)
adv.Text = "Show"
regKey.Close()
Else
regKey.SetValue("AdvancedTab", 0)
adv.Text = "Hide"
regKey.Close()
End If
End Sub
Even after removing regKey.close() registry doesn't update
Last edited by riteshtechie; Nov 23rd, 2009 at 05:49 AM.
< advertising link removed by moderator >
-
Nov 23rd, 2009, 03:10 PM
#5
Thread Starter
Lively Member
Re: [Help]Need help with Registry
BUMP!!!!! Sorry I didn't find anything that could help me
< advertising link removed by moderator >
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
|