Results 1 to 12 of 12
  1. #1
    georgelabra's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Location
    Greece
    Posts
    111
    Reputation
    10
    Thanks
    26
    My Mood
    Aggressive

    Laptop Battery Viewer (Only for laptop users)

    Heyy Guys Well here is an easy and fun tut .
    So open up vb and make a project
    resize however you want and add only 1 label(The label will show us our laptops battery energy.)
    So here is the code


    Code:
    Imports System.Runtime.InteropServices
    
    
    Public Class Form1
        Dim myManagedPower As New ManagedPower()
    
        Sub New()
            InitializeComponent()
            Label1.Text = myManagedPower.ToString()
        End Sub
    End Class
    
    Public Class ManagedPower
        Declare Auto Function GetSystemPowerStatus Lib "kernel32.dll" _
        Alias "GetSystemPowerStatus" (ByRef sps As SystemPowerStatus) As Boolean
    
        Public Overrides Function ToString() As String
            Dim text As String = ""
            Dim sysPowerStatus As SystemPowerStatus
            If ManagedPower.GetSystemPowerStatus(sysPowerStatus) Then
                Dim currentPowerStatus = sysPowerStatus.ACLineStatus
                text += "Power source: " + sysPowerStatus.ACLineStatus.ToString() + Environment.NewLine
                text += "Power status: "
    
    
    
                If sysPowerStatus.BatteryFlag = ManagedPower._BatteryFlag.Unknown Then
                    text += "Unknown"
    
                Else
                    Dim fCharging = (ManagedPower._BatteryFlag.Charging = _
          (sysPowerStatus.BatteryFlag & ManagedPower._BatteryFlag.Charging))
    
                    If fCharging Then
                        Dim currentChargingStatus = ManagedPower._BatteryFlag.Charging
                    End If
    
    
                    Dim currentPowerLevel As String
                    If sysPowerStatus.BatteryFlag = 0 Then
                        currentPowerLevel = "Medium                             "
                    Else
                        currentPowerLevel = sysPowerStatus.BatteryFlag.ToString()
                    End If
                    text += currentPowerLevel
    
    
                    If fCharging Then
                        Dim currentChargingStatus = ManagedPower._BatteryFlag.Charging.ToString()
                        text += " (" + ManagedPower._BatteryFlag.Charging.ToString() + ") "
                    End If
                End If
    
                ' Finally print the percentage of the battery life remaining.
                Dim currentBatteryPercentage = sysPowerStatus.BatteryLifePercent
                text += Environment.NewLine + "Battery life remaining is " + _
                sysPowerStatus.BatteryLifePercent.ToString() + "%"
            End If
            Return text
        End Function
    
        <StructLayout(LayoutKind.Sequential)> _
        Public Structure SystemPowerStatus
            Public ACLineStatus As _ACLineStatus
            Public BatteryFlag As _BatteryFlag
            Public BatteryLifePercent As Byte
            Public Reserved1 As Byte
            Public BatteryLifeTime As System.UInt32
            Public BatteryFullLifeTime As System.UInt32
        End Structure
    
        Public Enum _ACLineStatus As Byte
            Battery = 0
            AC = 1
            Unknown = 255
        End Enum
    
        <Flags()> _
        Public Enum _BatteryFlag As Byte
            High = 1
            Low = 2
            Critical = 4
            Charging = 8
            NoSystemBattery = 128
            Unknown = 255
        End Enum
    
    End Class





  2. The Following User Says Thank You to georgelabra For This Useful Post:

    Julma Henri (06-07-2013)

  3. #2
    Julma Henri's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    3,528
    Reputation
    205
    Thanks
    775
    My Mood
    In Love
    Did you code it by yourself ?
    Help me get donator.



    Want to become part of Editor Force? Click the tag below and apply now !

  4. #3
    xBear Grylls's Avatar
    Join Date
    Aug 2012
    Gender
    male
    Location
    Maryland
    Posts
    198
    Reputation
    14
    Thanks
    27
    My Mood
    Psychedelic
    Quote Originally Posted by Julma Henri View Post
    Did you code it by yourself ?
    Googled the code, looks as if he did, althought editing could have taken place.

  5. #4
    Julma Henri's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    3,528
    Reputation
    205
    Thanks
    775
    My Mood
    In Love
    Going to test tomorrow.
    Help me get donator.



    Want to become part of Editor Force? Click the tag below and apply now !

  6. #5
    georgelabra's Avatar
    Join Date
    Apr 2013
    Gender
    male
    Location
    Greece
    Posts
    111
    Reputation
    10
    Thanks
    26
    My Mood
    Aggressive
    Quote Originally Posted by Julma Henri View Post
    Did you code it by yourself ?
    Well i found this code in my usb

    Last edited by georgelabra; 06-03-2013 at 05:16 PM. Reason: Forgot signature

  7. #6
    atom0s's Avatar
    Join Date
    May 2013
    Gender
    male
    Posts
    403
    Reputation
    139
    Thanks
    104
    It's copied from online sources:
    *links*
    Last edited by Jorndel; 06-12-2013 at 02:05 PM.
    - Gone; this is another shit forum with children as administrators. Not worth contributing to.

  8. #7
    Cryptonic's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Location
    United Provinces of Canada
    Posts
    1,313
    Reputation
    44
    Thanks
    190
    My Mood
    Bored
    Weather it was copied or not, at least he's trying to make this section active.

  9. #8
    ~Syphox's Avatar
    Join Date
    May 2012
    Gender
    male
    Location
    The Third Reich
    Posts
    1,307
    Reputation
    337
    Thanks
    344
    My Mood
    Angelic
    Quote Originally Posted by atom0s View Post
    It's copied from online sources:
    So? He is just trying to contribute something really useful, some other are just releasing the WindowsMediaPlayer...
    ~Syphox

  10. #9
    lucasheer715's Avatar
    Join Date
    Jul 2012
    Gender
    male
    Posts
    648
    Reputation
    10
    Thanks
    497
    My Mood
    Bored
    guys, so what if he wanted yall to know this code? who cares. what if i went to google and couldnt find it? well it would be here at MPGH waiting for me.

  11. #10
    Julma Henri's Avatar
    Join Date
    Apr 2010
    Gender
    male
    Posts
    3,528
    Reputation
    205
    Thanks
    775
    My Mood
    In Love
    It is actually working
    Help me get donator.



    Want to become part of Editor Force? Click the tag below and apply now !

  12. #11
    swiftyspiffy's Avatar
    Join Date
    Jun 2013
    Gender
    male
    Posts
    22
    Reputation
    10
    Thanks
    3
    This is copy pasted code from online, which makes me sad. You should at least make the code more efficient, the efficiency of the code is poor.

  13. #12
    sillabub's Avatar
    Join Date
    Jul 2013
    Gender
    male
    Posts
    4
    Reputation
    10
    Thanks
    0
    Her picture where ?
    I want to see Screenshot

Similar Threads

  1. World Hax Public hack is only for Europe users!!
    By xPureangel in forum Blackshot Hacks & Cheats
    Replies: 5
    Last Post: 11-17-2012, 10:17 PM
  2. [Solved] Only For Good Users [ ADMINS , MODS ]
    By Sobia11 in forum CrossFire Help
    Replies: 1
    Last Post: 11-09-2011, 02:18 PM
  3. crossfire public hack for laptop users!!!
    By Osama_Farooq in forum CrossFire Hacks & Cheats
    Replies: 286
    Last Post: 08-10-2010, 10:33 PM
  4. [Please Sticky] Numpad Help For Laptop Users
    By Acen in forum Combat Arms Hacks & Cheats
    Replies: 46
    Last Post: 08-21-2009, 09:30 AM
  5. Only for 2008 Users...
    By DarkBright in forum Visual Basic Programming
    Replies: 1
    Last Post: 03-09-2008, 12:31 PM