문제

WM5 장치의 전원/대기 버튼을 성공적으로 갇혀 코드가 화면을 "스위칭"하지 못하도록 방지 한 사람이 있습니까?

조경 방향에서 화면을 사용하는 응용 프로그램이 있으며 (a) 사용자가 양손으로 장치를 보유하고 실수로 화면 전원을 공급하지 않고 (보너스로 - - b) UI 버튼으로 사용하십시오.

아마도 누군가가 낮은 수준의 해킹을 가지고 있습니까? IPAQ RX1950에서 전달 된대로 WM5를 사용하고 있습니다.

기억하십시오 불가능한 것은 없습니다 - 특히 WM5. 그 동안 직접 대답하면 질문을 업데이트하겠습니다.


업데이트!

나는 유용성의 역 순서로 작동하는 세 가지 트릭을 발견했습니다.

  1. 패치 keybddr.dll (이 장치에서), 좋아하는 수단을 통해 ROM을 다시 주입하십시오. 이 공장 ROM이있는이 장치에서는 작동하지만 영구적으로 비활성화하고 싶지 않았습니다.

  2. 전원 관리 메시지 큐에 동기화하고 장치가 내려갈 때마다 장치를 "켜십시오"를 돌립니다.

  3. 레지스트리에서 "전력 상태"를 변경하여 모두 (대부분) "ON". 이렇게하면 RAPI를 사용하여 전원 버튼을 비활성화하고 이벤트 X, Y 및 Z에서 레지스트리를 "재설정"하는 소프트웨어를 사용할 수 있습니다.

도움이 되었습니까?

해결책

전원 버튼의 구현은 OEM 의존적이므로 한 장치의 솔루션이 다른 장치에서 작동하지 않을 가능성이 높습니다. Windows Mobile 장치에서 구현의 광범위한 차이로 인해 많은 수준의 기능이 있어도 사실입니다.

대안에는 사물의 조합이 포함됩니다

  • 무인 모드로 응용 프로그램을 실행하십시오
  • 전력 변화 이벤트를 모니터링하십시오
  • 장치가 무인 모드로 변경되면 모드에서 완전한 요청

전력 관리에 대한 전체 논의는 여기서 논의 할 수있는 것 이상의 것입니다. 자세한 내용은 다음을 참조하십시오.http://www.codeproject.com/kb/mobile/wimopower1.aspx

여기에서 전원 이벤트에 등록 할 수있는 방법을 보여주는 샘플도 있습니다.http://www.codeproject.com/kb/mobile/wimoqueue.aspx

다른 팁

다음 코드는 전원 버튼을 비활성화하지 않지만 장치가 꺼지면 10 초 이내에 장치가 다시 켜집니다. 또한 전원 절약 기능을 비활성화합니다.

using System;
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Text;

namespace Core.Mobile
{
    /// <summary>
    /// Allows manipulation the power management i.e. system standby
    /// </summary>
    public static class PowerManipulation
    {
        #region Private variables
        private static System.Threading.Timer _timer = null;
        private const int INTERVAL = 10000; //10 seconds
        #endregion
        #region Public methods
        /// <summary>
        /// Prevents the application from suspending/sleeping
        /// </summary>
        public static void DisableSleep()
        {
            if (_timer == null)
            {
                _timer = new System.Threading.Timer(new System.Threading.TimerCallback(Timer_Tick), null, 0, INTERVAL);
            }
            try
            {
                PowerPolicyNotify(PPN_UNATTENDEDMODE, 1);  //Ensure the application still runs in suspend mode
            }
            catch { }
        }
        /// <summary>
        /// Allows suspend/sleep operations
        /// </summary>
        public static void EnableSleep()
        {
            if (_timer != null)
            {
                _timer.Dispose();
                _timer = null;
            }
            try
            {
                PowerPolicyNotify(PPN_UNATTENDEDMODE, 0);
            }
            catch { }
        }
        #endregion
        #region Private methods
        /// <summary>
        /// Internal timer for preventing standby
        /// </summary>
        private static void Timer_Tick(object state)
        {
            try
            {
                SystemIdleTimerReset();
                SetSystemPowerState(null, POWER_STATE_ON, POWER_FORCE);
            }
            catch { }
        }
        #endregion
        #region PInvoke
        private const int PPN_UNATTENDEDMODE = 0x00000003;
        private const int POWER_STATE_ON = 0x00010000;
        private const int POWER_STATE_OFF = 0x00020000;
        private const int POWER_STATE_SUSPEND = 0x00200000;
        private const int POWER_FORCE = 4096;
        private const int POWER_STATE_RESET = 0x00800000;
        /// <summary>
        /// This function resets a system timer that controls whether or not the
        /// device will automatically go into a suspended state.
        /// </summary>
        [DllImport("CoreDll.dll")]
        private static extern void SystemIdleTimerReset();
        /// <summary>
        /// This function resets a system timer that controls whether or not the
        /// device will automatically go into a suspended state.
        /// </summary>
        [DllImport("CoreDll.dll")]
        private static extern void SHIdleTimerReset();
        /// <summary>
        /// This function allows the current power state to be manipulated, i.e. turn the device on
        /// </summary>
        [DllImport("coredll.dll", SetLastError = true)]
        static extern int SetSystemPowerState(string psState, int StateFlags, int Options);
        /// <summary>
        /// This function sets any power notification options
        /// </summary>
        [DllImport("CoreDll.dll")]
        static extern bool PowerPolicyNotify(int dwMessage, int onOrOff);
        #endregion
    }
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top