update von registry

  • Thread starter Thread starter Anil Bakirci
  • Start date Start date
A

Anil Bakirci

How can I update the registry, after i change a key value to take effect ?
There is nothing usefull in Microsoft.Win32.Registry und
Microsoft.Win32.RegistryKey.

Wie kann man in .NET ein Registry-Update machen ohne den Computer
neuzustarten ?
In Microsoft.Win32.Registry und Microsoft.Win32.RegistryKey konnte ich so
was nicht finden.
 
Anil said:
How can I update the registry, after i change a key value to take
effect ? There is nothing usefull in Microsoft.Win32.Registry und
Microsoft.Win32.RegistryKey.

Isn't there?

From the MSDN docs on RegistryKey.SetValue:

SetValue - Sets the value of a name/value pair in the registry key.
Depending on the overload, the registry data type is determined from the
type of data being stored or from a specified RegistryValueKind.

What exactly are you trying, and how is it not meeting your expectations?

-cd
 
The problem is that i have to restart the pc in order the registry setting
takes effect.
Very simple example :

RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"Control
Panel\Colors", true);
regkey.SetValue("Background", "102 51 255", RegistryValueKind.String);
regkey.Close();

i see that it is changed in the regeditor but it does only work after i
restart the computer.
i need an update function so that the restart would not be necessary.
 
The problem is that i have to restart the pc in order the registry setting
takes effect.
Very simple example :

RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"Control
Panel\Colors", true);
regkey.SetValue("Background", "102 51 255", RegistryValueKind.String);
regkey.Close();

i see that it is changed in the regeditor but it does only work after i
restart the computer.
i need an update function so that the restart would not be necessary.

Have you searched for documentation on that specific registry key?
Some registry values only take effect after a restart, because they are read
only once, or only after a logon sequence for example.
If that is the case, there is very little you can do about it.

if the registry editor shows the new value, it is really in the registry.
There is no special update function.
it all depends on the application / subsystem that reads the value.

--

Kind regards,
Bruno van Dooren
(e-mail address removed)
Remove only "_nos_pam"
 
Anil Bakirci said:
The problem is that i have to restart the pc in order the registry setting
takes effect.
Very simple example :

RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"Control
Panel\Colors", true);
regkey.SetValue("Background", "102 51 255", RegistryValueKind.String);
regkey.Close();

i see that it is changed in the regeditor but it does only work after i
restart the computer.
i need an update function so that the restart would not be necessary.

What you're seeing is not related to updating the registry, but rather to
caching of the UI parameters outside of the registry (e.g. in Explorer.exe
and within the Win32 subsystem). Most of those UI-settings regristry keys
are only read at startup, or when the WM_SETTINGSCHANGE message is received.
Typically, after changing any of these settings, an application will post
WM_SETTINGSCHANGE to all top-level windows on the system. Many applications
will ignore this setting, but the Windows shell (explorer) does honor it.

-cd
 
Most of those UI-settings regristry keys are only read at startup....

or more precisely for HKCU, at the time of login.

Brian
 
Back
Top