Groups | Blog | Home
all groups > dotnet compact framework > november 2004 >

dotnet compact framework : Refresh battery status for GetSystemPowerStatusEx()


Paul G. Tobey [eMVP]
11/30/2004 4:48:17 PM
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.

[quoted text, click to view]

Mike D Sutton
11/30/2004 11:42:41 PM
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

Mike D Sutton
12/1/2004 12:52:50 AM
[quoted text, click to view]

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

AddThis Social Bookmark Button