<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[GetSystemPowerStatus]]></title><description><![CDATA[<p>Hi,</p>
<p>ich schreibe gerade ein Programm, das den Akku-Status anzeigt. Ich verwende GetSystemPowerStatus(). Wenn ich das Programm ausführe, auf einem Laptop selbstverständlich mit eingestecktem Ladekabel, hat BatteryFlag den Wert 9, der eigentlich nicht in der Liste der mögliche Werte aufgeführt ist. Da ich anhand dieses Wertes entscheiden will ob &quot;Laden... x%&quot; oder nur &quot;x%&quot; ausgegeben wird, wär das schon wichtig zu wissen. Kurz gesagt, suche ich eine genaue Zuordnung von den einzelnen Werten (1 - 255).</p>
<p>Siehe: <a href="http://msdn2.microsoft.com/en-us/library/aa372693.aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/aa372693.aspx</a></p>
<p>MfG WilMen :xmas1:</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/200937/getsystempowerstatus</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 11:29:43 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/200937.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 21 Dec 2007 18:24:43 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to GetSystemPowerStatus on Fri, 21 Dec 2007 18:29:16 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich schreibe gerade ein Programm, das den Akku-Status anzeigt. Ich verwende GetSystemPowerStatus(). Wenn ich das Programm ausführe, auf einem Laptop selbstverständlich mit eingestecktem Ladekabel, hat BatteryFlag den Wert 9, der eigentlich nicht in der Liste der mögliche Werte aufgeführt ist. Da ich anhand dieses Wertes entscheiden will ob &quot;Laden... x%&quot; oder nur &quot;x%&quot; ausgegeben wird, wär das schon wichtig zu wissen. Kurz gesagt, suche ich eine genaue Zuordnung von den einzelnen Werten (1 - 255).</p>
<p>Siehe: <a href="http://msdn2.microsoft.com/en-us/library/aa372693.aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/aa372693.aspx</a></p>
<p>MfG WilMen :xmas1:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1424564</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1424564</guid><dc:creator><![CDATA[WilMen]]></dc:creator><pubDate>Fri, 21 Dec 2007 18:29:16 GMT</pubDate></item><item><title><![CDATA[Reply to GetSystemPowerStatus on Sat, 22 Dec 2007 01:56:57 GMT]]></title><description><![CDATA[<p>Naja eigentlich ist er aufgelistet <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> . Da steht ja:</p>
<p>MSDN schrieb:</p>
<blockquote>
<p>This member can contain one or more of the following flags.</p>
</blockquote>
<p>Das heißt, dass mehrere Werte 'in einem' enthalten sind (- das nennt man &quot;Bitcodierung von Daten&quot;). Wenn Du Dir die einzelnen definierten Werte anguckst, sieht man da eine gewisse Regelmäßigkeit (1, 2, 4, 8, ...), welche auf Bitflags schließen lässt.</p>
<p>Du musst also mit den Bitoperatoren prüfen, ob Dein gesuchter Wert enthalten ist, also so:</p>
<pre><code class="language-cpp">SYSTEM_POWER_STATUS spsInfo = { 0 };
GetSystemPowerStatus(&amp;spsInfo);
if(spsInfo.BatteryFlag &amp; 8)
  // Charging...
if(spsInfo.BatteryFlag &amp; 1)
  // Battery-Power-Level: High, &gt; 66%

// und so weiter ...
</code></pre>
<p>In Deinem Fall (also beim Wert 9) ist <strong>8</strong> ( <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/27a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--right_arrow"
      title=":arrow_right:"
      alt="➡"
    /> 'Charging') und <strong>1</strong> ( <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/27a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--right_arrow"
      title=":arrow_right:"
      alt="➡"
    /> 'High—the battery capacity is at more than 66 percent') gesetzt <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> .</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1424692</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1424692</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sat, 22 Dec 2007 01:56:57 GMT</pubDate></item><item><title><![CDATA[Reply to GetSystemPowerStatus on Sat, 22 Dec 2007 18:55:22 GMT]]></title><description><![CDATA[<p>Hi CodeFinder,</p>
<p>danke für die schnelle Antwort inklusive Erklärung!</p>
<p>MfG WilMen :xmas1:</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1424923</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1424923</guid><dc:creator><![CDATA[WilMen]]></dc:creator><pubDate>Sat, 22 Dec 2007 18:55:22 GMT</pubDate></item></channel></rss>