Make your own free website on Tripod.com

AllApi.net

[an error occurred while processing this directive]
 
Private Type SYSTEM_POWER_STATUS
        ACLineStatus As Byte
        BatteryFlag As Byte
        BatteryLifePercent As Byte
        Reserved1 As Byte
        BatteryLifeTime As Long
        BatteryFullLifeTime As Long
End Type
Private Declare Function GetSystemPowerStatus Lib "kernel32" (lpSystemPowerStatus As SYSTEM_POWER_STATUS) As Long
Private Sub Form_Paint()
    'KPD-Team 2000
    'URL: http://www.allapi.net/
    'E-Mail: KPDTeam@Hotmail.com
    Dim SPS As SYSTEM_POWER_STATUS
    'get the battery powerstatus
    GetSystemPowerStatus SPS
    Me.AutoRedraw = True
    'show some information
    Select Case SPS.ACLineStatus
        Case 0
            Me.Print "AC power status: Offline"
        Case 1
            Me.Print "AC power status: OnLine"
        Case 2
            Me.Print "AC power status: Unknown"
    End Select
    Select Case SPS.BatteryFlag
        Case 1
            Me.Print "Battery charge status: High"
        Case 2
            Me.Print "Battery charge status: Low"
        Case 4
            Me.Print "Battery charge status: Critical"
        Case 8
            Me.Print "Battery charge status: Charging"
        Case 128
            Me.Print "Battery charge status: No system battery"
        Case 255
            Me.Print "Battery charge status: Unknown Status"
    End Select
End Sub


 
Copyright © 1998-2000, The KPD-Team.
Send mail to KPDTeam@Allapi.net with comments about this web site.
This site is located at
http://www.Allapi.net/