A
Anil Bakirci
How is this possible ?
Some control panel items provide an apply button that instantly resets the
registry change and continue with the changed settings.
Here is the example :
right click on the desktop -> (display)properties ->desktop
than if i select any color (let's assume black) and click on the apply
button; i get a window "Please Wait, the reg key "HKEY_CURRENT_USER /
ControlPanel / Colors / Background" is set to dec-value 0 0 0 and i get a
black backgorund.
But if change the regkey manually with registry editor to 0 0 0 or with
external c#-Function SetValue, the regkey is set to 0 0 0 but it does not
take effect, in other words i dont get a black background.
I tried this :
static class SafeNativeMethods
{
public static IntPtr HWND_BROADCAST = (IntPtr)0xffff;
public static int WM_WININICHANGE = 0x001A;
[DllImport("User32.Dll")]
public static extern bool PostMessage(IntPtr hWnd, int Msg, int wParam, int
lParam);
}
public static class Refresher
{
public static void ReloadSettings()
{
SafeNativeMethods.PostMessage(SafeNativeMethods.HWND_BROADCAST,
SafeNativeMethods.WM_WININICHANGE, 0, 5000);
}
}
static void ExWin()
{
Form form = new Form();
Refresher.ReloadSettings();
Application.Run(form);
}
But it also didnt work. So what's the trick, that Windows updates/refreshes
the registry, when i click the apply button ? For those, who say that it is
only possible for the operating system :
There are several softwares on the market, which play with the registry
settings and do not force the user to restart the PC.
Actually, what i'm currently tring to write is a likely windows tweaker.
Some control panel items provide an apply button that instantly resets the
registry change and continue with the changed settings.
Here is the example :
right click on the desktop -> (display)properties ->desktop
than if i select any color (let's assume black) and click on the apply
button; i get a window "Please Wait, the reg key "HKEY_CURRENT_USER /
ControlPanel / Colors / Background" is set to dec-value 0 0 0 and i get a
black backgorund.
But if change the regkey manually with registry editor to 0 0 0 or with
external c#-Function SetValue, the regkey is set to 0 0 0 but it does not
take effect, in other words i dont get a black background.
I tried this :
static class SafeNativeMethods
{
public static IntPtr HWND_BROADCAST = (IntPtr)0xffff;
public static int WM_WININICHANGE = 0x001A;
[DllImport("User32.Dll")]
public static extern bool PostMessage(IntPtr hWnd, int Msg, int wParam, int
lParam);
}
public static class Refresher
{
public static void ReloadSettings()
{
SafeNativeMethods.PostMessage(SafeNativeMethods.HWND_BROADCAST,
SafeNativeMethods.WM_WININICHANGE, 0, 5000);
}
}
static void ExWin()
{
Form form = new Form();
Refresher.ReloadSettings();
Application.Run(form);
}
But it also didnt work. So what's the trick, that Windows updates/refreshes
the registry, when i click the apply button ? For those, who say that it is
only possible for the operating system :
There are several softwares on the market, which play with the registry
settings and do not force the user to restart the PC.
Actually, what i'm currently tring to write is a likely windows tweaker.