0
在Windown Mobile 6,在設置\系統\電源\雜項下有一個「禁用電源開關」,我必須檢查編程以擺脫彈出菜單。通過比較registried我想通了,它可以設置槽'Drivers \ BuiltIn \ Power \ Settings'註冊表項,設置DisablePwrSwitch爲1.事件名稱爲禁用電源按鈕
問題是,它是不夠的設置註冊表,你也有爲驅動程序設置事件強制他重新加載設置(或者您可以重置設備,但這是一個醜陋的解決方案)。
我可以teoretically實現它:
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);
但我不知道實際eventStrign。 "OMNIBOOK_EVENT_SHUTDOWN"
當然不是正確的。
有人有一個想法,什麼是該驅動程序重新加載設置的eventName?
爲什麼你認爲這是一個事件,而不是像'WM_SETTINGCHANGE'廣播? – ctacke 2013-02-16 14:27:32
我試過'[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);'但電源按鈕仍然保持活動狀態。難道我做錯了什麼? – HoGo 2013-02-18 08:33:43