pythonCE GetSystemPowerState windows api

L

lorenzo.mentaschi

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
 
T

Thomas Heller

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?

Python 2.5 (release25-maint, Dec 19 2006, 23:22:00) [MSC v.1201 32 bit (ARM)] on win32

Thomas
 
L

lorenzo.mentaschi

(e-mail address removed) schrieb:


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?

Python 2.5 (release25-maint, Dec 19 2006, 23:22:00) [MSC v.1201 32 bit (ARM)] on win32>>> from ctypes import *'0x10010000L'

Thomas

Thank you very much! :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top