How to make an app - Andromo App Maker

Announcement

Collapse
No announcement yet.

Battery percentage refresh DLL

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

  • Battery percentage refresh DLL

    Hi can anyone point me in the right direction to get this to work.
    I am using a battery percentage DLL for my Laptop. I would like the DLL to refresh every say 10 seconds or more. to give me the exact percentage of the battery. The problem is, once the application is running, it only gives the percentage, from when it started, and don't change.
    I have plaid around with times but cant get it to work.

    My question is can a DLL be refreshed say every 10 seconds or even a minute. If not, how can this be done. I don't want the application to reload.

    Here is the code I am using.
    Code:
    --BATTERY--
    function TextToLabel(op, arg)
        result = Label.GetText("Label1");
        if result == "" then
            Label.SetText("Label1", op..": "..arg);
        else
            Label.SetText("Label1", op..": "..arg.."\r\n"..result);
        end
    end
    
    Label.SetText("Label1", "");
    ----------------------------------------------------------------------------
    DLLPath = _SourceFolder.."\\AutoPlay\\Docs\\Battery.dll";
    
    result = DLL.CallFunction(DLLPath, "LifePercent","", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
    
    TextToLabel("LifePercent", result.."%");

  • #2
    I have plaid around with timers but cant get it to work.

    Comment


    • #3
      Assuming you're calling the DLL parameters correctly, just place this on the Page On Show event:
      Code:
      Page.StartTimer(10000); -- starts and fires timer every 10,000 millisecs (10 secs)
      .. and your code on the Page's On Timer event. Should work fine.

      Comment


      • #4
        Do you have the DLL please so we can test with the same dll as yourself
        BunnyHop CDD Obscurer Download No Longer Supported
        Plugins or Sources MokoX

        Comment


        • #5
          Originally posted by kingzooly View Post
          Do you have the DLL please so we can test with the same dll as yourself
          LOL yes, might've been helpful.

          Failing that, he can use madsen's Batty DLL to do the same thing:



          To have it to refresh every 10 secs like u want, just move the code over onto the Page Timer and fire it up from the Page On Show event (like I outlined above).

          Direct link to madsen's APZ: here
          Original thread-post: here

          Nb. He supplied this back in 2010 - but will work 'as is' in AMS-8. (No updating necessary).

          Comment


          • #6
            I don't remember the last post on that topic but seems I already used it in the past lol
            BunnyHop CDD Obscurer Download No Longer Supported
            Plugins or Sources MokoX

            Comment


            • #7
              Thank you BioHazard
              I used madsen's APZ and worked as you said above.
              Thank you

              Comment


              • #8
                It works well for myself in preview also but not built it yet to see if it bugs out in built versions like it did in the past for me, but at the moment I can't see a use for this in a project so I find it hard to work it on to a build, my mind works in silly ways
                BunnyHop CDD Obscurer Download No Longer Supported
                Plugins or Sources MokoX

                Comment


                • #9
                  Originally posted by kingzooly View Post
                  It works well for myself in preview also but not built it yet to see if it bugs out in built versions like it did in the past for me...
                  Can confirm that built versions tested under WinXP appear to be working bug-free, no problem.
                  Can't confirm for Win7/10 though. Anyone?

                  Comment


                  • #10
                    Just for fun - here's an APZ rebuild (with 30-sec auto-refresh).
                    Hey, I was bored. LOL.
                    Attached Files

                    Comment


                    • #11
                      Oops - page not refreshing like intended.
                      LOL, forgot to move DLL call command onto timer & query event.
                      FIXED & reupped! Nagdamit!

                      PS.
                      See, this is why we need a forum EDIT button!
                      LOL, hint, hint, IR.
                      Attached Files

                      Comment


                      • #12
                        @ BioHazard I am using this on Windows 7 with no bugs at the moment.

                        Comment


                        • #13
                          Can a Dialog warning message be added when the battery reaches 10%

                          Comment


                          • #14
                            Originally posted by MrBryza View Post
                            Can a Dialog warning message be added when the battery reaches 10%
                            Sure. Just append the following to the end of the code on the Query button. And ditto with the page's On Timer event:
                            Code:
                            if nBattStatus == "10" then
                                Dialog.Message("Warning", "Battery charge is at 10%", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
                            end
                            Or, like this:
                            Code:
                            if nBattStatus < "10" then
                                Dialog.Message("Warning", "Battery charge is below 10%", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
                            end

                            Comment


                            • #15
                              Edit,
                              It should be obvious - but just in case it isn't - the above code snippet applies to my rebuild APZ.
                              If using madsen's original APZ, you'd have to change the nBattStatus variable back to BattPercentEx.

                              Comment

                              Working...
                              X