News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

battery power percentage

Started by elmo, March 26, 2011, 10:50:04 AM

Previous topic - Next topic

elmo

I have a laptop.
I use WinXP.

If my laptop battery almost empty, there will be a notification "Low battery" on the taskbar.
I had searched a code in this forum about how to do it. But I found nothing.

So the problem is: how to get ampere/volt/vendor of battery installed in my laptop with MASM code?

Would you like to give me a clue?
Thank you.
Make program with MASM is very interesting. :U
be the king of accounting programmer world!

oex

It depends on your hardware as to how much information you will get.... As far as I remember some laptops will *only* tell you when you have a few percentage points left....

GetSystemPowerStatus
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

elmo

thanks for quick reply!

this link will help solve my problem
http://www.asmcommunity.net/board/index.php?topic=29838.0

i want to learn it first!
many thanks for the information oex!
be the king of accounting programmer world!

elmo

ok this is the solution

      invoke GetSystemPowerStatus,ADDR SPS
      .if SPS.BatteryLifeTime == -1
         invoke MessageBox,hWin,SADD("Batery almost empty. Prepare to shutdown"),SADD("info"),0
      .else
         invoke MessageBox,hWin,SADD("Batery not empty"),SADD("info"),0
      .endif

:cheekygreen: :dance:
be the king of accounting programmer world!

elmo

be the king of accounting programmer world!