Can change registry values, but how to make system read changes?

  • Thread starter Thread starter keithbessette
  • Start date Start date
K

keithbessette

Hey all,

I needed to change the power settings on my device through my app, so I
ended up using RegOpenKeyEx, RegSetValueEx, and RegCloseKey from
coredll.dll. The changes I make are written successfully (proven with
a registry reader), but don't affect the system until 1.) warm boot the
device OR 2.) i go to settings > power >advanced to actually view them.
it's as if the power settings in the registry can be changed, but after
the registry is changed, some sort of current profile settings need to
be updated. any ideas anyone?
Thanks, Keith


more info: I want to turn off the auto-suspend feature on battery
power, so I'm changing
SYSTEM\\CurrentControlSet\\Control\\Power\\Timeouts: BattSuspendTimeout
value: '\0\0' ->encoded as a unicode dword -> 0 in the registry
AND
SYSTEM\\CurrentControlSet\\Control\\Power: BattPowerOff value: '\0\0'

Device will not stop suspending until I view the power settings that
display exactly that or I warm boot the device.
 
Thanks for the quick reply. I tried what you suggested (see code
below), maybe I'm doing something wrong. Then I came across this link,
which seems to discuss this issue not working.
http://www.eggheadcafe.com/ng/microsoft.public.smartphone.developer/post20596834.asp

Thanks again


code: c#

[DllImport("coredll.dll")]
public static extern void SendMessage(int hwnd, int wm_sc, int val1,
int val2);
.....
int hwnd_broadcast = 0xFFFF;
int wm_settingchange = 0x001A;
SendMessage(hwnd_broadcast, wm_settingchange, 0, 0);
 
Back
Top