pythonCE GetSystemPowerState windows api

lorenzo.mentaschi at yahoo.it lorenzo.mentaschi at yahoo.it
Sat Apr 25 14:38:37 CEST 2009


Hi all,
I need to call GetSystemPowerState windows api from pythonCE, because
I need to know if a windows ce 5 device is in sleep/off status.
I can find this api in ctypes.windll.coredll, but I cannot figure out
how to pass parameters to this procedure: msdn giude (
http://msdn.microsoft.com/en-us/library/ms899319.aspx ) speaks about 3
parameters, of wich 2 are output: a "LPWSTR pBuffer" and a "PDWORD
pFlags". Returned value of the call is an exit status code
rappresenting if call succeded or failed.

I tried to call this api in several ways, but obtained always exit
code 87 (meaning that parameters are wrong) or 122 (meaning "pBuffer"
variable is too small, in this case I passed None as pBuffer, since
I'm interested only in pFlags result).

Have you any idea? Maybe another api or way to perform this simple
task?

Thank you all, Lorenzo



More information about the Python-list mailing list