0

on Windown Mobile 6, under Settings\System\Power\Misc there is a "Disable Power Switch" what I have to check programatically to get rid of popup menu. By comparing registried I figured out, that it can be set trough 'Drivers\BuiltIn\Power\Settings' registry key, settings DisablePwrSwitch to 1.

The problem is, that it is not enough to set registry, you also have to set event for the driver to force him to reload settings (or you can reset device, but it is an ugly solution).

I can achieve it teoretically with:

private static void DoAutoResetEvent()
{
    string eventString = "OMNIBOOK_EVENT_SHUTDOWN";

    IntPtr newHandle = CreateEvent(IntPtr.Zero, false, false, eventString);
    EventModify(newHandle, (int)EventFlags.EVENT_SET);
    CloseHandle(newHandle);
}

private enum EventFlags
{
    EVENT_PULSE = 1,
    EVENT_RESET = 2,
    EVENT_SET = 3
}

[DllImport("coredll.dll", SetLastError = true)]
private static extern IntPtr CreateEvent(IntPtr lpEventAttributes, bool bManualReset, bool bInitialState, string lpName);

[DllImport("coredll")]
static extern bool EventModify(IntPtr hEvent, int func);

[DllImport("coredll.dll", SetLastError = true)]
private static extern bool CloseHandle(IntPtr hObject);

But I do not know the actual eventStrign for that. "OMNIBOOK_EVENT_SHUTDOWN" is of course not the correct one.

Have somebody an idea, what is the eventName to reload settings by this driver?

HoGo
  • 147
  • 2
  • 17
  • Why do you think it's an event, and not something like a `WM_SETTINGCHANGE` broadcast? – ctacke Feb 16 '13 at 14:27
  • I tried `[DllImport("coredll.dll", SetLastError = true)] public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam); IntPtr HWND_BROADCAST = new IntPtr(0xffff); int WM_SETTINGCHANGE = 0x1A; IntPtr result = SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, 0);` but power button still remains active. Am I doing something wrong? – HoGo Feb 18 '13 at 08:33

1 Answers1

0

Our WM6 devices don't have this Disable Power Switch.

If this is something added by a device manufacturer (Motorola, Datalogic, etc.), you would need to contact them about getting a driver and how to use it.