[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.
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?
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
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
Re: [Help]Need help with Registry
BUMP!!!!! Sorry I didn't find anything that could help me