Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Support

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-23-2009, 10:11 AM
js js is offline
Senior Member
 
Join Date: Jun 2007
Posts: 110
Unhappy laptop battery level..... .. .. .

please tel me....how to code and capture the status of battery left and time left of a laptop battery under xp and vista OS

regards
js
Reply With Quote
  #2 (permalink)  
Old 12-27-2009, 09:07 AM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default

Code:
struct {
    unsigned char ACLineStatus; // Checks to see if you're connected to the
                                // wall outlet or not
    unsigned char BatteryFlag;  // Battery status
    unsigned char BatteryLifePercent; // precentage left
    unsigned char Reserved1; // Dont use
    long BatteryLifeTime; // Total time left of your battery
    long BatteryFullLifeTime; // Total UPtime of your battery                           
} SYSTEM_POWER_STATUS;

dllimport "kernel32.dll" stdcall long GetSystemPowerStatus(SYSTEM_POWER_STATUS*);

var info = new Object;
info.data = new Struct(SYSTEM_POWER_STATUS);

if (GetSystemPowerStatus(info) != 0) {
    if (info.data.ACLineStatus == 1) {
        // the battery is online
        trace("The battery can still be working for " + info.data.BatteryLifeTime + " seconds");
    } else {
        trace("The battery isn't online");
    }
}
For more details, please see the following MSDN page
SYSTEM_POWER_STATUS Structure (Windows)
Reply With Quote
  #3 (permalink)  
Old 01-13-2010, 01:19 PM
js js is offline
Senior Member
 
Join Date: Jun 2007
Posts: 110
Default

@monkey91
..........WTF u wrote :/
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:03 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.