Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to obtain the battery design capacity of a laptop?
Forum Updated to NodeBB v4.3 + New Features

How to obtain the battery design capacity of a laptop?

Scheduled Pinned Locked Moved Unsolved General and Desktop
9 Posts 3 Posters 503 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    YUTONG
    wrote on last edited by YUTONG
    #1

    I want to know how to obtain the design capacity of the computer battery. I have tried using the wmic command and calling the Windows API, and I have tried it all but failed.

    JonBJ 1 Reply Last reply
    0
    • Y YUTONG

      I want to know how to obtain the design capacity of the computer battery. I have tried using the wmic command and calling the Windows API, and I have tried it all but failed.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @YUTONG If Windows wmic fails I'm not sure what Qt can do about that. It's very Windows-specific.

      Christian EhrlicherC 1 Reply Last reply
      0
      • JonBJ JonB

        @YUTONG If Windows wmic fails I'm not sure what Qt can do about that. It's very Windows-specific.

        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        You can find an example in the msdn documentation. It already queries the correct InformationLevel (BatteryInformation).

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        Y 1 Reply Last reply
        1
        • Christian EhrlicherC Christian Ehrlicher

          You can find an example in the msdn documentation. It already queries the correct InformationLevel (BatteryInformation).

          Y Offline
          Y Offline
          YUTONG
          wrote on last edited by
          #4

          @Christian-Ehrlicher
          I tried to find the function 'GetSystemPowerStatus' from msdn and extracted the design capacity of the battery from it. But my computer cannot display the numerical value of the designed capacity.

          Christian EhrlicherC 1 Reply Last reply
          0
          • Y YUTONG

            @Christian-Ehrlicher
            I tried to find the function 'GetSystemPowerStatus' from msdn and extracted the design capacity of the battery from it. But my computer cannot display the numerical value of the designed capacity.

            Christian EhrlicherC Offline
            Christian EhrlicherC Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @YUTONG said in How to obtain the battery design capacity of a laptop?:

            But my computer cannot display the numerical value of the designed capacity.

            What does this mean?

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            Y 1 Reply Last reply
            0
            • Christian EhrlicherC Christian Ehrlicher

              @YUTONG said in How to obtain the battery design capacity of a laptop?:

              But my computer cannot display the numerical value of the designed capacity.

              What does this mean?

              Y Offline
              Y Offline
              YUTONG
              wrote on last edited by
              #6

              @Christian-Ehrlicher The program runs without any errors, but does not display the output value, which is a null value.b61ac7c85acd39f13cb43607ea68681.png Like this, it doesn't output any values after it

              Christian EhrlicherC 1 Reply Last reply
              0
              • Y YUTONG

                @Christian-Ehrlicher The program runs without any errors, but does not display the output value, which is a null value.b61ac7c85acd39f13cb43607ea68681.png Like this, it doesn't output any values after it

                Christian EhrlicherC Offline
                Christian EhrlicherC Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on last edited by
                #7

                And how should we help you when you post a screenshot of your app instead the relevant code.

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                Y 1 Reply Last reply
                0
                • Christian EhrlicherC Christian Ehrlicher

                  And how should we help you when you post a screenshot of your app instead the relevant code.

                  Y Offline
                  Y Offline
                  YUTONG
                  wrote on last edited by
                  #8

                  @Christian-Ehrlicher 797c9a24-0d2b-428b-9459-09e7f37428a6-image.png

                  Christian EhrlicherC 1 Reply Last reply
                  0
                  • Y YUTONG

                    @Christian-Ehrlicher 797c9a24-0d2b-428b-9459-09e7f37428a6-image.png

                    Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Please stop posting images but your code with the proper code tags.

                    Your code prints something to stdout and not to a widget from your former post. What do you expect? That stdout is magically redirected to your widget?

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    1 Reply Last reply
                    1

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved