BBC BASIC for Windows
« Laptop Charge »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:21pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Laptop Charge  (Read 716 times)
JB91
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 47
xx Laptop Charge
« Thread started on: Apr 2nd, 2011, 11:52am »

I wasn't sure which category to put this in, but how would you be able to get the current level of charge on a laptop?

Josh.
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Laptop Charge
« Reply #1 on: Apr 2nd, 2011, 5:42pm »

on Apr 2nd, 2011, 11:52am, JB91 wrote:
I wasn't sure which category to put this in, but how would you be able to get the current level of charge on a laptop?

Check out the CallNtPowerInformation API:

http://msdn.microsoft.com/en-us/library/aa372675.aspx

The SystemBatteryState information level seems to be what you need:

http://msdn.microsoft.com/en-us/library/aa373212.aspx

Richard.
User IP Logged

JB91
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 47
xx Re: Laptop Charge
« Reply #2 on: Apr 3rd, 2011, 09:28am »

Can you provide an example program, because whenevre I do it, it seems to fail... huh
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Laptop Charge
« Reply #3 on: Apr 3rd, 2011, 2:23pm »

on Apr 3rd, 2011, 09:28am, JB91 wrote:
Can you provide an example program, because whenevre I do it, it seems to fail... huh

I can't see anything particularly difficult that might be causing your problem; it appears to be a straightforward API to use. Do make sure you adhere to the MSDN documentation in every detail.

The only pitfall I can see which might possibly trip you up is that the Spare1[4] in the SYSTEM_BATTERY_STATE structure must be converted to Spare1%(3) in BBC BASIC, because the suffix is the maximum value of the subscript not the number of elements.

If you're still having problems, post the code which is failing.
User IP Logged

JB91
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 47
xx Re: Laptop Charge
« Reply #4 on: Apr 3rd, 2011, 2:34pm »

It works now!
Thanks! wink
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls