我需要一个能够检测设备空闲状态的 Windows Mobile 5 程序(紧凑框架 3.5)。目前,我只是检查背光是否关闭,如下所示:
[DllImport("coredll.dll", EntryPoint = "sleep", SetLastError = true)]
internal static extern void sleep(int dwMilliseconds);
....
//Get the current power state of the system
int winError = CoreDLL.GetSystemPowerState(systemStateName, out systemPowerStates);
if (winError == 0)
{
//If the backlight is off, consider the state to be idle.
if (systemStateName.ToString() == "backlightoff")
{
idle = true;
}
}
我认为这可能接近了答案,但我想知道设备是否真的没有被使用。