WM 6.5 application crash on switching the screen off RRS feed

  • Question

  • Hi,
    I've been using a ScreenState class to switch off the screen from the menu;
    everything workes fine (tested on WM < 6.5) but on WM 6.5 calling ScreenOff crashes the app;
    what might have changed on new windows? is there any other way to do the same action?
    thanks in advance;

    public class ScreenState
        const int POWER_STATE_ON = 0x00010000;
        const int POWER_STATE_OFF = 0x00020000;
        const int POWER_STATE_SUSPEND = 0x00200000;
        const int POWER_FORCE = 4096;
        const int POWER_STATE_RESET = 0x00800000;
        const int POWER_STATE_IDLE = 0x00100000;
        const int POWER_STATE_BACKLIGHTON = 0x02000000;
        const int POWER_DUMPDW = 0x00002000;
        const int POWER_STATE_USERIDLE = 0x01000000;

        [System.Runtime.InteropServices.DllImport("coredll", SetLastError = true)]
        static extern int SetSystemPowerState(string psState, int StateFlags, int Options);

        public static int ScreenOff()
            return SetSystemPowerState(null, POWER_STATE_IDLE, POWER_DUMPDW);
    Monday, March 1, 2010 9:59 AM


  • The problem you are encountering may not be Windows Mobile 6.5 specific. The power manager in WM devices is implemented by the OEM and they have a great deal of liberty in how they implement it. What result do you get when you use POWER_STATE_USERIDLE ?
    It takes all the running you can do to stay in one place.If you want to get somewhere else,you must try to run at least twice as fast as that.
    • Marked as answer by warrentang Friday, March 5, 2010 3:33 AM
    Monday, March 1, 2010 1:25 PM