views:

89

answers:

1

I am trying to get the user idle state of my Windows Mobile device.

When I run the function GetSystemPowerState (after 15 min of not touching the device) I get the following value:

Dec: 302055424
Hex: 0x12010000
Bin: 10010000000010000000000000000

I was hoping that PowerState & POWER_STATE_USERIDLE == POWER_STATE_USERIDLE would be true. But POWER_STATE_USERIDLE is 0x01000000 and I have 0x02000000.

I went to look up 0x02000000 and found that it is not in pm.h.

What does 0x02000000 mean? Where could I go to find out?

+2  A: 

According to pm.h (found in %WINCEROOT%\PUBLIC\COMMON\SDK\INC)

#define POWER_STATE(f)           ((f) &  0xFFFF0000) // power state mask
#define POWER_STATE_ON           (DWORD)(0x00010000) // on state
#define POWER_STATE_OFF          (DWORD)(0x00020000) // no power, full off
#define POWER_STATE_CRITICAL     (DWORD)(0x00040000) // critical off
#define POWER_STATE_BOOT         (DWORD)(0x00080000) // boot state
#define POWER_STATE_IDLE         (DWORD)(0x00100000) // idle state
#define POWER_STATE_SUSPEND      (DWORD)(0x00200000) // suspend state
#define POWER_STATE_UNATTENDED   (DWORD)(0x00400000) // Unattended state.
#define POWER_STATE_RESET        (DWORD)(0x00800000) // reset state
#define POWER_STATE_USERIDLE     (DWORD)(0x01000000) // user idle state
#define POWER_STATE_BACKLIGHTON  (DWORD)(0x02000000) // device scree backlight on
#define POWER_STATE_PASSWORD     (DWORD)(0x10000000) // This state is password protected.

So it looks to me like you have the following:

POWER_STATE_ON | POWER_STATE_BACKLIGHTON | POWER_STATE_PASSWORD

ctacke
Sweet! Thanks. I must have something funny going on. I have 5 versions of pm.h on my machine and none of them have POWER_STATE_BACKLIGHTON in them. They are located at: *C:\Program Files\Windows Mobile 5.0 SDK R2\PocketPC\Include\Armv4i*, *C:\Program Files\Windows Mobile 5.0 SDK R2\Smartphone\Include\Armv4i*, *C:\Program Files\Microsoft Visual Studio 9.0\SmartDevices\SDK\PocketPC2003\Include*, *C:\Program Files\Microsoft Visual Studio 9.0\SmartDevices\SDK\Smartphone2003\Include*, *C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Include\Armv4i*. I am using VS 2008.
Vaccano
Which is why I think everyone that does WinMo/CE development should install at least the eval version of Platform Builder. The shared source code is invaluable. You can copy it off and then uninstall the eval if you like.
ctacke
I have never heard of Platform Builder. I looked it up with my MSDN account. The newest version I could find on MSDN was *Windows CE .NET 4.2* and was published in 2003. Is that the software you are referring to?
Vaccano
ctacke