Re: why this API (SetSystemPowerState) can not change the system power state??



Hi, Michel

Thank you.

According to what you said, it works. I can change the system power state
from useridle to on. Thank you very much.

But I still don't understand why this API, SetSystemPowerState, does not
work??? Could you tell me why?

Thank you again.

Best Regards

Ricky

--



"Michel Verhagen (eMVP)" <michel@xxxxxxxxxx>
??????:enwhacdoIHA.1772@xxxxxxxxxxxxxxxxxxxxxxx
Open the named event "PowerManager/ActivityTimer/UserActivity" and set it
whenever you want to transition to "on". It's all in the registry and the
code, and as I said, not difficult to find:

; This registry setting tells GWES to signal the Power Manager
; when user input devices are active. GWES will reset this activity timer
; whenever it dequeues any type of input event (keyboard, mouse, or
; touch) from its internal queue.
[HKEY_LOCAL_MACHINE\SYSTEM\GWE]
"ActivityEvent"="PowerManager/ActivityTimer/UserActivity"



Good luck,

Michel Verhagen, eMVP
Check out my blog: http://GuruCE.com/blog

GuruCE Ltd.
Microsoft Embedded Partner
http://GuruCE.com
Consultancy, training and development services.

Hzh wrote:
Hi, Michel

Thank you very much for your response and advice.

My OS version is wince 5.0. And my system will get into useridle mode if
we don't operate my CE device after one or more minutes, the backlight of
my CE device will turn dark too. so if I plug in the usb cable and charge
the battery or communicate with the PC, I want to move the system out of
useridle into on and turn on the backlight.

so if I got the usb plug in evnet in my usb driver programe, I will call
this API and change the system power state from useridle into on, but it
does not work, the system power state still keep in useridle mode, and
the backlight still keep its old state too. most importantly, I can not
get the PBT_TRANSITION notification from the PM. That puzzles me greatly.



.