Announcement

Collapse
No announcement yet.

Query Battery Status

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    Luacom seems to be something to look into yet still far from actually getting the battery info from what I see.

    My project will run only on XP (since it targets a very specific kind of tablet) so I still believe in a DLL posibility Any believers out there?
    Human Relativity: No one is alike, which is what makes us alike, at any given time. --Myself

    Comment


    • #17
      Solution

      Found a solution for this. Gonna post a sample shortly No lua, no mess!
      Human Relativity: No one is alike, which is what makes us alike, at any given time. --Myself

      Comment


      • #18
        Ready

        Alright, here we are. Built a DLL Don't ya love FREE DLL's?

        Functions:
        BattPercentEx - Gets the current battery percentage status.
        BattPowerEx - Gets the current plugged in status (1 for plugged in and 0 for on battery power as seen on the example).

        Tested on WinXP and Win7 both plugged and unplugged. This should be used from Win2000 up.

        Attached APZ and DLL included. Feel free to use it as you wish for both comercial and personal purposes
        Attached Files
        Human Relativity: No one is alike, which is what makes us alike, at any given time. --Myself

        Comment


        • #19
          Forgot to mention, I have packed this as AMS7 for those who haven't upgraded yet, however I have tested it on AMS8 and works just the same.
          Human Relativity: No one is alike, which is what makes us alike, at any given time. --Myself

          Comment


          • #20
            Originally posted by madsen View Post
            Forgot to mention, I have packed this as AMS7 for those who haven't upgraded yet, however I have tested it on AMS8 and works just the same.
            I looked over luacom for hours for you could not find the right way to return the battary data i could retunr if it was a battary or not but failed the rest of the way lol glad you found a way lol.

            Comment


            • #21
              Luacom seems to be something to look into yet still far from actually getting the battery info from what I see.
              LuaCom is very powerful, it enables you to use ActiveX controls in your AMS projects, it will not enable you to get the battery life, but it will enable you to use many tools to achieve such a task.
              Embrace change in your life, you never know, it could all work out for the best

              Comment


              • #22
                Originally posted by madsen View Post
                Forgot to mention, I have packed this as AMS7 for those who haven't upgraded yet, however I have tested it on AMS8 and works just the same.
                function explorer.power()
                local PowerEx = DLL.CallFunction("batty.dll", "BattPowerEx", "", DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL);
                local levelEx = DLL.CallFunction("batty.dll", "BattPercentEx", "", DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL);

                if(PowerEx == "1")then
                PowerMode = "Wire";
                else
                PowerMode = "Battery";
                end

                return {type = PowerMode, typeraw = powerex, percent=String.ToNumber(levelEx)}
                end

                anyone know why in **** this is not working, it workings in the example but now it returns Battey when its wire and its returning 0 or nil as the level

                and every time I try add the bloody thing to a timer it also brakes as I wanted to use it with the very pritty ProgressEX
                I really don't want to use a OCX or mess about with the memary plugin or other plugins to get the battey details as its
                a pain and I don't want to make the user click to check each time I just want my function to work

                Comment

                Working...
                X