<?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[GDI: pixelausgabe - warum funzt es nicht?]]></title><description><![CDATA[<p>hi, hab mich leider ewig nichtmehr mit c beschäftigt, hab dementsprechend auch kaum mehr ahnung. also frag ich einfach mal drauf los:</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;
#include &lt;windows.h&gt;

int main(int argc, char* argv[])
{

	HDC hdcScreen = CreateDC(&quot;DISPLAY&quot;, NULL, NULL, NULL);
	COLORREF p = GetPixel(hdcScreen,511,383);
	printf(&quot;val: %i %i %i\n&quot;, GetRValue(p),GetGValue(p),GetBValue(p));
	return 0;
}
</code></pre>
<p>warum bekomm ich hier immer &quot;0 0 0&quot; raus?</p>
<p>vielen dank schonmal für jede hilfe</p>
<p>edit: ok an der stelle schein wohl was schwarzes gewesen zu sein <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
<p>ich finde den löschen button nicht</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/181935/gdi-pixelausgabe-warum-funzt-es-nicht</link><generator>RSS for Node</generator><lastBuildDate>Tue, 07 Jul 2026 14:49:57 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/181935.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 19 May 2007 00:30:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to GDI: pixelausgabe - warum funzt es nicht? on Sat, 19 May 2007 00:31:21 GMT]]></title><description><![CDATA[<p>hi, hab mich leider ewig nichtmehr mit c beschäftigt, hab dementsprechend auch kaum mehr ahnung. also frag ich einfach mal drauf los:</p>
<pre><code class="language-cpp">#include &quot;stdafx.h&quot;
#include &lt;stdio.h&gt;
#include &lt;windows.h&gt;

int main(int argc, char* argv[])
{

	HDC hdcScreen = CreateDC(&quot;DISPLAY&quot;, NULL, NULL, NULL);
	COLORREF p = GetPixel(hdcScreen,511,383);
	printf(&quot;val: %i %i %i\n&quot;, GetRValue(p),GetGValue(p),GetBValue(p));
	return 0;
}
</code></pre>
<p>warum bekomm ich hier immer &quot;0 0 0&quot; raus?</p>
<p>vielen dank schonmal für jede hilfe</p>
<p>edit: ok an der stelle schein wohl was schwarzes gewesen zu sein <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
<p>ich finde den löschen button nicht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1287758</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1287758</guid><dc:creator><![CDATA[pixartist]]></dc:creator><pubDate>Sat, 19 May 2007 00:31:21 GMT</pubDate></item><item><title><![CDATA[Reply to GDI: pixelausgabe - warum funzt es nicht? on Sat, 19 May 2007 22:51:07 GMT]]></title><description><![CDATA[<p>pixartist schrieb:</p>
<blockquote>
<p>edit: ok an der stelle schein wohl was schwarzes gewesen zu sein <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
</blockquote>
<p>Ne das hat damit nix zu tun <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="😉"
    /> . Du erstellst hier nur einen Speicherkontext der <strong>kompatibel</strong> zum Bildschirm ist. Dieser HDC ist standardmäßig (vollständig) schwarz. Wenn Du die Farbe eines bestimmten Pixels auf dem Bildschirm ermitteln willst, musst Du wie folgt vorgehen (C++):</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;iostream&gt;

int main()
{
    using namespace std;

    const int iX = 0, iY = 0; // Position auf dem Desktop
    HDC hdcScreen = GetWindowDC(NULL);
    COLORREF clrScreen = GetPixel(hdcScreen, iX, iY);
    cout &lt;&lt; &quot;(&quot; &lt;&lt; iX &lt;&lt; &quot;|&quot; &lt;&lt; iY &lt;&lt; &quot;), RGB(&quot;
         &lt;&lt; GetRValue(clrScreen) &lt;&lt; &quot;, &quot;
         &lt;&lt; GetGValue(clrScreen) &lt;&lt; &quot;, &quot;
         &lt;&lt; GetBValue(clrScreen) &lt;&lt; &quot;)&quot; &lt;&lt; endl;
    return (0);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1288238</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1288238</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Sat, 19 May 2007 22:51:07 GMT</pubDate></item></channel></rss>