<?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[GetPixel RCL_INVALID]]></title><description><![CDATA[<p>Hallo zusammen</p>
<p>Ich versuchen von einem Fenster einen Pixel einzulesen und dessen Farbe zu bestimmen.<br />
Hört sich eigentlich ganz einfach an, jedoch ich bekomm es einfach nicht hin.</p>
<pre><code class="language-cpp">void __fastcall TForm1::SpeedButton1Click(TObject *Sender)
{
        HWND Handle = FindWindow(NULL, &quot;Form1&quot;);   //fenster suchen
        COLORREF RGBColor;
        BYTE ColorR;
        BYTE ColorG;
        BYTE ColorB;
        POINT Point;

        Point.x = 100;
        Point.y = 100;

        Point = ClientToScreen(Point);                  //koordinaten konvertieren

        if(Handle)
        {
                HDC dc = GetWindowDC(Handle);
                RGBColor = GetPixel(dc, Point.x, Point.y);
                if(RGBColor != CLR_INVALID)
                {
                        ColorR = GetRValue(RGBColor);   //wird nie erreicht
                        ColorG = GetGValue(RGBColor);
                        ColorB = GetBValue(RGBColor);
                }
        }
}
</code></pre>
<p>Was mir bisher auch nicht ganz klar ist, ob ich die Koordinaten konvertieren muß oder nicht? ES funktioniert beides nicht.<br />
Ich bekomme für GRBColor immer einen Wert von 4294967295UL (0xFFFFFFFF) welches anscheinend CLR_INVALID ist.</p>
<p>Vielen dank.<br />
MfG Stephan</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/100558/getpixel-rcl_invalid</link><generator>RSS for Node</generator><lastBuildDate>Tue, 28 Apr 2026 19:05:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/100558.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 08 Feb 2005 14:14:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Tue, 08 Feb 2005 14:14:11 GMT]]></title><description><![CDATA[<p>Hallo zusammen</p>
<p>Ich versuchen von einem Fenster einen Pixel einzulesen und dessen Farbe zu bestimmen.<br />
Hört sich eigentlich ganz einfach an, jedoch ich bekomm es einfach nicht hin.</p>
<pre><code class="language-cpp">void __fastcall TForm1::SpeedButton1Click(TObject *Sender)
{
        HWND Handle = FindWindow(NULL, &quot;Form1&quot;);   //fenster suchen
        COLORREF RGBColor;
        BYTE ColorR;
        BYTE ColorG;
        BYTE ColorB;
        POINT Point;

        Point.x = 100;
        Point.y = 100;

        Point = ClientToScreen(Point);                  //koordinaten konvertieren

        if(Handle)
        {
                HDC dc = GetWindowDC(Handle);
                RGBColor = GetPixel(dc, Point.x, Point.y);
                if(RGBColor != CLR_INVALID)
                {
                        ColorR = GetRValue(RGBColor);   //wird nie erreicht
                        ColorG = GetGValue(RGBColor);
                        ColorB = GetBValue(RGBColor);
                }
        }
}
</code></pre>
<p>Was mir bisher auch nicht ganz klar ist, ob ich die Koordinaten konvertieren muß oder nicht? ES funktioniert beides nicht.<br />
Ich bekomme für GRBColor immer einen Wert von 4294967295UL (0xFFFFFFFF) welches anscheinend CLR_INVALID ist.</p>
<p>Vielen dank.<br />
MfG Stephan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/717733</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/717733</guid><dc:creator><![CDATA[_Stephan_]]></dc:creator><pubDate>Tue, 08 Feb 2005 14:14:11 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Tue, 08 Feb 2005 14:16:37 GMT]]></title><description><![CDATA[<p>If the pixel is outside of the current clipping region, the return value is CLR_INVALID.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/717737</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/717737</guid><dc:creator><![CDATA[....]]></dc:creator><pubDate>Tue, 08 Feb 2005 14:16:37 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Tue, 08 Feb 2005 14:33:49 GMT]]></title><description><![CDATA[<p>Hallo zusammen<br />
@....</p>
<p>Kannst du mir bitte mal erklären was das nun genau für mich bedeutet, bzw was mach ich falsch oder was muß ich anderst machen.<br />
Habe leider nicht wirklich Ahnung von WinAPI.</p>
<p>MfG Stephan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/717753</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/717753</guid><dc:creator><![CDATA[_Stephan_]]></dc:creator><pubDate>Tue, 08 Feb 2005 14:33:49 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Tue, 08 Feb 2005 14:39:55 GMT]]></title><description><![CDATA[<p>Das heißt, dass die Pixelangaben falsch sind.</p>
<p>Ich verstehe nicht ganz was ClientToScreen bringen soll, ich schätze daran liegt's.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/717762</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/717762</guid><dc:creator><![CDATA[Anfänger14]]></dc:creator><pubDate>Tue, 08 Feb 2005 14:39:55 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Tue, 08 Feb 2005 14:51:53 GMT]]></title><description><![CDATA[<p>nimm doch zum test mal x = 1 und y = 1 und lass die konvertierung weg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/717778</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/717778</guid><dc:creator><![CDATA[teste]]></dc:creator><pubDate>Tue, 08 Feb 2005 14:51:53 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Tue, 08 Feb 2005 15:07:19 GMT]]></title><description><![CDATA[<p>Hallo zusammen</p>
<p>Ob ich mit ClientToScreen arbeite oder ohne macht keinen unterschied.<br />
Wenn ich als Koordinate x = 1, y = 1 nehme habe ich leider auch kein anderes Ergebnis.</p>
<p>MfG Stephan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/717794</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/717794</guid><dc:creator><![CDATA[_Stephan_]]></dc:creator><pubDate>Tue, 08 Feb 2005 15:07:19 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Tue, 08 Feb 2005 15:13:59 GMT]]></title><description><![CDATA[<p>Was sagt denn dein Debugger?</p>
<p>- Ist Handle gültig? (springt er überhaupt in die if-Verzweigung?)<br />
- Ist dc gültig? (liefert GetPixel vielleicht deshalb Müll?)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/717798</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/717798</guid><dc:creator><![CDATA[Hepi]]></dc:creator><pubDate>Tue, 08 Feb 2005 15:13:59 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Tue, 08 Feb 2005 15:20:55 GMT]]></title><description><![CDATA[<p>Hallo zusammen</p>
<p>Also das Handle ist gültige (ungleich NULL).<br />
Ich vermute, daß das dc aus gültig ist, da es auch ungleich NULL ist.</p>
<p>Das erste if wird durchlaufen, jedoch das zweite nicht.</p>
<p>MfG Stephan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/717807</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/717807</guid><dc:creator><![CDATA[_Stephan]]></dc:creator><pubDate>Tue, 08 Feb 2005 15:20:55 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Wed, 09 Feb 2005 08:46:31 GMT]]></title><description><![CDATA[<p>Hallo zusammen</p>
<p>Hat den keiner mehr eine Idee?<br />
Verwende BCB6.0 Pro unter W2K bzw XP Pro.</p>
<p>MfG Stephan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/718368</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/718368</guid><dc:creator><![CDATA[_Stephan_]]></dc:creator><pubDate>Wed, 09 Feb 2005 08:46:31 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Wed, 09 Feb 2005 11:43:56 GMT]]></title><description><![CDATA[<p>Habe ich das richtig verstanden, dass nach</p>
<pre><code class="language-cpp">HDC dc = GetWindowDC(Handle);
</code></pre>
<p>dc ungleich NULL ist, aber</p>
<pre><code class="language-cpp">RGBColor = GetPixel(dc, 1, 1);
</code></pre>
<p>trotzdem CLR_INVALID zurückliefert?!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/718506</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/718506</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Wed, 09 Feb 2005 11:43:56 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Wed, 09 Feb 2005 12:00:40 GMT]]></title><description><![CDATA[<p>Hallo zusammen</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/1644">@flenders</a><br />
Das hast Du genau richtig verstanden.</p>
<p>MfG Stephan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/718527</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/718527</guid><dc:creator><![CDATA[_Stephan_]]></dc:creator><pubDate>Wed, 09 Feb 2005 12:00:40 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Wed, 09 Feb 2005 12:14:51 GMT]]></title><description><![CDATA[<p>hi. mal eine zwischenfrage. ist CLR_INVALID nicht das selbe wie RGB(255, 255, 255) also weiß?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/718538</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/718538</guid><dc:creator><![CDATA[zwischenfrage]]></dc:creator><pubDate>Wed, 09 Feb 2005 12:14:51 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Wed, 09 Feb 2005 12:47:53 GMT]]></title><description><![CDATA[<p>Hallo zusammen</p>
<p>@zwischenfrage<br />
Habe keine Ahnung ob dies so ist, habe allerdings nichts weisses in meinem Formular.</p>
<p>MfG Stephan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/718575</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/718575</guid><dc:creator><![CDATA[_Stephan_]]></dc:creator><pubDate>Wed, 09 Feb 2005 12:47:53 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Wed, 09 Feb 2005 15:05:12 GMT]]></title><description><![CDATA[<p><em>Stephan</em> schrieb:</p>
<blockquote>
<p>Habe keine Ahnung ob dies so ist, habe allerdings nichts weisses in meinem Formular.</p>
</blockquote>
<p>Habe das gerade mal mit 1/1 getestet, und dort ist aufgrund des &quot;3D-Rahmens&quot; tatsächlich weiß - allerdings geht er bei mir auch dann in if(RGBColor != CLR_INVALID) hinein <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/718756</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/718756</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Wed, 09 Feb 2005 15:05:12 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Wed, 09 Feb 2005 15:32:01 GMT]]></title><description><![CDATA[<p>Hallo zusammen</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/1644">@flenders</a><br />
Ok, das mit dem 3D Rahmen ist nachvollziehbar, jedoch ich kann eingeben was für Koordinaten ich will, und bekomme dann immer Weiß.</p>
<p>MfG Stephan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/718790</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/718790</guid><dc:creator><![CDATA[_Stephan_]]></dc:creator><pubDate>Wed, 09 Feb 2005 15:32:01 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Wed, 09 Feb 2005 16:25:33 GMT]]></title><description><![CDATA[<p>Dann scheint dein Fehler wo anders zu liegen, denn bei mir funktioniert der Code <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/718847</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/718847</guid><dc:creator><![CDATA[flenders]]></dc:creator><pubDate>Wed, 09 Feb 2005 16:25:33 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Wed, 09 Feb 2005 18:54:45 GMT]]></title><description><![CDATA[<p>Hallo.<br />
Konnte es auch nicht glauben das dein Code nicht funktioniert. Ich musste dann aber feststellen das ich es auch nicht hinkriege. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;

int main()
{
	HWND hWnd = FindWindow(NULL, &quot;Form1&quot;);

	if(hWnd == NULL)
	{
		MessageBox(NULL, &quot;Kein Fenster gefunden!&quot;, NULL, MB_OK);
		return 0;
	}

	HDC hDC = GetWindowDC(hWnd);

	if(hDC == NULL)
	{
		MessageBox(NULL, &quot;Fehler bei GetWindowDC&quot;, NULL, MB_OK);
		return 0;
	}

	COLORREF color = GetPixel(hDC, 1, 1);

	if(color == CLR_INVALID)
	{
		MessageBox(NULL, &quot;Fehler bei GetPixel&quot;, NULL, MB_OK);
		return 0;
	}
}
</code></pre>
<p>Bei mir endet das immer in &quot;Fehler bei GetPixel&quot;. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/718972</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/718972</guid><dc:creator><![CDATA[*heul*]]></dc:creator><pubDate>Wed, 09 Feb 2005 18:54:45 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Wed, 09 Feb 2005 18:58:29 GMT]]></title><description><![CDATA[<p>Ah doch, funktioniert. Das Fenster darf nur nicht verdeckt sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/718976</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/718976</guid><dc:creator><![CDATA[*freu*]]></dc:creator><pubDate>Wed, 09 Feb 2005 18:58:29 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Wed, 09 Feb 2005 19:10:04 GMT]]></title><description><![CDATA[<p>Ich hab die Logik dahinter aber noch nicht verstanden. Es kommt irgendwie immer darauf an wo das Fenster ist. Wenn ich es zu weit nach unten positioniere (Taskleiste) dann kommt der Fehler bei GetPixel, obwohl sagen wir mal 100 Pixel in der Höhe zu sehen sind. Schiebe ich es etwas weiter rauf, funktioniert es wieder.</p>
<p>Hat bestimmt was mit dieser Clipping Region zu tun.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/718990</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/718990</guid><dc:creator><![CDATA[*freu*]]></dc:creator><pubDate>Wed, 09 Feb 2005 19:10:04 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Wed, 09 Feb 2005 19:14:48 GMT]]></title><description><![CDATA[<p>Ach sorry das ich hier soviel scheisse schreibe. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /><br />
Ich hatte aus versehen statt x = 1 und y = 1 gerade x = 100 und y = 100 ausprobiert. Also vergeßt den letzten Beitrag.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/719000</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/719000</guid><dc:creator><![CDATA[*freu*]]></dc:creator><pubDate>Wed, 09 Feb 2005 19:14:48 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel RCL_INVALID on Thu, 10 Feb 2005 07:02:23 GMT]]></title><description><![CDATA[<p>Hallo zusammen</p>
<p>@*freu*<br />
Erst mal vielen Dank für die Infos.<br />
Mein Fenster war immer im Hintergrund, da ich mir die Werte immer im Debugger angeschaut habe, und einen Breakpoint auf if(Handle) gesetzt hatte.</p>
<p>Wenn ich mir jetzt die Werte auf einem Label anzeigen lassen, dann sind sie plausibel.</p>
<p>Also vielen Dank an alle für eure Hilfe.</p>
<p>MfG Stephan</p>
]]></description><link>https://www.c-plusplus.net/forum/post/719291</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/719291</guid><dc:creator><![CDATA[_Stephan_]]></dc:creator><pubDate>Thu, 10 Feb 2005 07:02:23 GMT</pubDate></item></channel></rss>