K
keith
Hey all,
I posted a question yesterday that gave me some leads
(http://groups-beta.google.com/group...c289ae31c59/77cedcb4df7c2a0c#77cedcb4df7c2a0c)
and after some dd I came up with the code below (.net cf, c#). I'm now
using SendMessageTimeout to broadcast WM_SETTINGCHANGE so the shell
will see the changes i've made to the registry (turning auto-suspend
off via 'BattSuspendTimeout' and 'BattPowerOff'). Even though
SendMessageTimeout returns a success value, it doesnt work(or atleast
do what i expected it to).
Thanks again, Keith
[DllImport("coredll.dll", SetLastError=true)]
public static extern Int32 SendMessageTimeout(IntPtr hWnd,
UInt32 Msg, UInt16 wParam,
string lParam, Int32 fuFlags,
Int32 uTimeout, ref UInt32 lpdwResult );
....
const UInt16 WM_SETTINGCHANGE = 0x001A;
const int SMTO_NORMAL = 0x00000000;
UInt32 result = 0;
string pEnv = "Power"; //registry leaf for BattPowerOff
int uu = SendMessageTimeout((IntPtr)hwnd_broadcast, WM_SETTINGCHANGE,
0, pEnv, SMTO_NORMAL, 3000, ref result);
pEnv = "Timeouts"; //registry leaf for BattSuspendTimeout
uu = SendMessageTimeout((IntPtr)hwnd_broadcast, WM_SETTINGCHANGE, 0,
pEnv, SMTO_NORMAL, 3000, ref result);
I posted a question yesterday that gave me some leads
(http://groups-beta.google.com/group...c289ae31c59/77cedcb4df7c2a0c#77cedcb4df7c2a0c)
and after some dd I came up with the code below (.net cf, c#). I'm now
using SendMessageTimeout to broadcast WM_SETTINGCHANGE so the shell
will see the changes i've made to the registry (turning auto-suspend
off via 'BattSuspendTimeout' and 'BattPowerOff'). Even though
SendMessageTimeout returns a success value, it doesnt work(or atleast
do what i expected it to).
Thanks again, Keith
[DllImport("coredll.dll", SetLastError=true)]
public static extern Int32 SendMessageTimeout(IntPtr hWnd,
UInt32 Msg, UInt16 wParam,
string lParam, Int32 fuFlags,
Int32 uTimeout, ref UInt32 lpdwResult );
....
const UInt16 WM_SETTINGCHANGE = 0x001A;
const int SMTO_NORMAL = 0x00000000;
UInt32 result = 0;
string pEnv = "Power"; //registry leaf for BattPowerOff
int uu = SendMessageTimeout((IntPtr)hwnd_broadcast, WM_SETTINGCHANGE,
0, pEnv, SMTO_NORMAL, 3000, ref result);
pEnv = "Timeouts"; //registry leaf for BattSuspendTimeout
uu = SendMessageTimeout((IntPtr)hwnd_broadcast, WM_SETTINGCHANGE, 0,
pEnv, SMTO_NORMAL, 3000, ref result);