Refresh battery status for GetSystemPowerStatusEx()

M

Mike D Sutton

I'm calling the GetSystemPowerStatusEx() API in a class from a Timer object's Tick event hander about once every 30 seconds. The
call itself works fine and I get back valid data however it always seems to return the same value until opening Start -> Settings ->
Power, which somehow refreshes the battery status and I start getting that value back in my application. Is there some way I can do
whatever the power screen is doing to refresh the status (I've tried both true and false as the last parameter, but no
difference?..)
Also is there a more accurate way of establishing the battery level, it seems it stays at 100% for a while then 'jumps' to about 80%
and so on rather than being a smooth progression, or is this a 'feature' of the memory/OS?
This is being written in C# 2003 for a Pocket PC.
Cheers,

Mike
 
P

Paul G. Tobey [eMVP]

I've never seen that sort of problem on any of our devices. You should be
setting the last parameter to TRUE. When you make the call, it should be
forwarded to the battery driver. At that point, you should get the same
information as is used to display the power status via the standard shell.
Are you checking the return value of the call? Is it always TRUE?

Paul T.
 
M

Mike D Sutton

I've never seen that sort of problem on any of our devices. You should be
setting the last parameter to TRUE. When you make the call, it should be
forwarded to the battery driver. At that point, you should get the same
information as is used to display the power status via the standard shell.
Are you checking the return value of the call? Is it always TRUE?

It turns out that the problem was actually down to the drawing of the returned data rather than the call itself, thanks for the help
though and just to clarify the call works fine - It seems that it's just me that doesn't!
Cheers,

Mike
 

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

Top