Keep Windows Mobile 6 phone alive

2019-04-12 04:18发布

问题:

I am making an application for Windows Mobile 6.1 Pocket PC (Touchscreen). I know when a Pocket PC's screen turns off, it goes into a standby mode and applications are pretty much halted in the background. My application can't do that. It needs to keep going. So my question is, how can I keep the phone alive (backlight turned on) until my application is done?

An example of this would be video streaming applications such as Youtube. It keeps the phone on while the video is playing.

回答1:

As long as your app is doing something (in a loop or a Timer) it is relatively easy, you need:

public static class CoreTools
{
    [DllImport("coredll.dll")]
    public static extern void SystemIdleTimerReset();
}

And then call SystemIdleTimerReset() regularly.