<?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]]></title><description><![CDATA[<p>hallo,<br />
ich wollte von einem Programm mit GetPixel die RGB Werte auslesen lassen.<br />
Es klappt alles. Zuerst öffne ich das Programm &quot;Delay&quot; und dann mein Programm, welches die Werte von &quot;Delay&quot; auslesen sollte. Leider bekomm ich jedes mal nur diese Ausgabe: 4294967295. Um zu testen wo der Fehler liegt habe ich<br />
eine Ausgabe gemacht falls handle nicht klappt bzw getdc doch dies wird nicht ausgegeben das heißt es hat geklappt. Weiß vielleicht einer wo der Fehler liegt? Muss ich das Colorref anders ausgeben lassen?<br />
Vielen Dank</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;iostream&gt;
#include &lt;stdlib.h&gt;
#include &lt;string&gt;
using namespace std;

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   PSTR szCmdLine, int iCmdShow)
    {
        HWND hWnd;
        hWnd = FindWindow(0,&quot;Delay&quot;);
        if(!hWnd)
        cout &lt;&lt; &quot;Handle nicht geklappt&quot; &lt;&lt; endl; 
        HDC summ = GetDC(hWnd);
        if(!summ)
        cout &lt;&lt; &quot;getdc nicht geklappt&quot; &lt;&lt; endl;
        COLORREF ref = GetPixel(summ,399, 299);
        cout &lt;&lt; ref &lt;&lt; endl;
        return 0;
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/194409/getpixel</link><generator>RSS for Node</generator><lastBuildDate>Tue, 30 Jun 2026 06:39:31 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/194409.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 06 Oct 2007 14:25:39 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to GetPixel on Sat, 06 Oct 2007 14:25:39 GMT]]></title><description><![CDATA[<p>hallo,<br />
ich wollte von einem Programm mit GetPixel die RGB Werte auslesen lassen.<br />
Es klappt alles. Zuerst öffne ich das Programm &quot;Delay&quot; und dann mein Programm, welches die Werte von &quot;Delay&quot; auslesen sollte. Leider bekomm ich jedes mal nur diese Ausgabe: 4294967295. Um zu testen wo der Fehler liegt habe ich<br />
eine Ausgabe gemacht falls handle nicht klappt bzw getdc doch dies wird nicht ausgegeben das heißt es hat geklappt. Weiß vielleicht einer wo der Fehler liegt? Muss ich das Colorref anders ausgeben lassen?<br />
Vielen Dank</p>
<pre><code class="language-cpp">#include &lt;windows.h&gt;
#include &lt;iostream&gt;
#include &lt;stdlib.h&gt;
#include &lt;string&gt;
using namespace std;

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                   PSTR szCmdLine, int iCmdShow)
    {
        HWND hWnd;
        hWnd = FindWindow(0,&quot;Delay&quot;);
        if(!hWnd)
        cout &lt;&lt; &quot;Handle nicht geklappt&quot; &lt;&lt; endl; 
        HDC summ = GetDC(hWnd);
        if(!summ)
        cout &lt;&lt; &quot;getdc nicht geklappt&quot; &lt;&lt; endl;
        COLORREF ref = GetPixel(summ,399, 299);
        cout &lt;&lt; ref &lt;&lt; endl;
        return 0;
    }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1379194</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1379194</guid><dc:creator><![CDATA[NaNoXiD]]></dc:creator><pubDate>Sat, 06 Oct 2007 14:25:39 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel on Sat, 06 Oct 2007 14:56:41 GMT]]></title><description><![CDATA[<p>Was genau hast du da mit der Konsole vor? Und wie genau soll der Wert ausgegeben werden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1379210</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1379210</guid><dc:creator><![CDATA[mad_martin]]></dc:creator><pubDate>Sat, 06 Oct 2007 14:56:41 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel on Sat, 06 Oct 2007 14:59:43 GMT]]></title><description><![CDATA[<p>die Ausgabe sollte eigentlich 3 Zahlen sein<br />
z.b. 200 150 30 also die Farbe vom Pixel</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1379212</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1379212</guid><dc:creator><![CDATA[NaNoXiD]]></dc:creator><pubDate>Sat, 06 Oct 2007 14:59:43 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel on Sat, 06 Oct 2007 16:01:20 GMT]]></title><description><![CDATA[<p>Hier mal ein Beispiel wie sowas aussehen könnte.</p>
<pre><code class="language-cpp">HWND hWnd=::FindWindow(NULL,&quot;Rechner&quot;);
HDC hdc=::GetDC(hWnd);

POINT pt; 
GetCursorPos(&amp;pt);

::ScreenToClient(hWnd, &amp;pt); 

int xwert=0; 
int ywert=0; 

xwert=pt.x; 
ywert=pt.y;

unsigned long RGB=GetPixel(hdc,xwert,ywert);
unsigned char xxxR = GetRValue(RGB);
unsigned char xxxG = GetGValue(RGB); 
unsigned char xxxB = GetBValue(RGB); 

CString cs_rot,cs_gruen,cs_blau;
cs_rot.Format(&quot;%i&quot;,xxxR);
cs_gruen.Format(&quot;%i&quot;,xxxG);
cs_blau.Format(&quot;%i&quot;,xxxB);

CString farbe;
farbe=cs_rot;
farbe+=&quot;,&quot;;
farbe+=cs_gruen;
farbe+=&quot;,&quot;;
farbe+=cs_blau;

MessageBox(farbe,&quot;RGB-Farbwert&quot;);
</code></pre>
<p>Ich hoffe es hilft dir weiter <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/1379243</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1379243</guid><dc:creator><![CDATA[Shell32]]></dc:creator><pubDate>Sat, 06 Oct 2007 16:01:20 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel on Sat, 06 Oct 2007 16:22:40 GMT]]></title><description><![CDATA[<p>vielen dank nach sowas habe ich gesucht<br />
leider kann ich es nicht kompiliren<br />
fehlermeldungen:<br />
struct std:. string has no member named format<br />
Cstring undeclared<br />
farbe undecleared</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1379256</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1379256</guid><dc:creator><![CDATA[NaNoXiD]]></dc:creator><pubDate>Sat, 06 Oct 2007 16:22:40 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel on Sat, 06 Oct 2007 17:14:47 GMT]]></title><description><![CDATA[<p>Ja ist auch klar, da es in den Bereich MFC gehört (CString).<br />
Du musst es dann halt in einen normalen string/char umwandeln.<br />
Oder eben als integer weiterverwenden...wie auch immer.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1379310</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1379310</guid><dc:creator><![CDATA[Shell32]]></dc:creator><pubDate>Sat, 06 Oct 2007 17:14:47 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel on Sat, 06 Oct 2007 17:33:35 GMT]]></title><description><![CDATA[<p>ich habs jetzt so gemacht und ich jetz kann ich es auch Kompilieren<br />
aber es tut immernoch nicht das was ich will<br />
Jetzt gibt es manchmal Zeichen aus z.b. ! , ,</p>
<pre><code class="language-cpp">HWND hWnd=::FindWindow(NULL,&quot;Delay&quot;);
        if(!hWnd)
        cout &lt;&lt; &quot;Handle nicht geklappt&quot; &lt;&lt; endl;
        HDC hdc=::GetDC(hWnd);
        if(!hdc)
        cout &lt;&lt; &quot;getdc nicht geklappt&quot; &lt;&lt; endl;
        POINT pt;
        GetCursorPos(&amp;pt);
        ::ScreenToClient(hWnd, &amp;pt);
        int xwert=399;
        int ywert=299;
        xwert=pt.x;
        ywert=pt.y;
        COLORREF RGB=GetPixel(hdc,xwert,ywert);
        COLORREF xxxR = GetRValue(RGB);
        COLORREF xxxG = GetGValue(RGB);
        COLORREF xxxB = GetBValue(RGB);
        //string cs_rot,cs_gruen,cs_blau;
        //cs_rot=xxxR;
        //cs_gruen=xxxG;
        //cs_blau=xxxB;
        string farbe;
        farbe=xxxR;
        farbe+=&quot;,&quot;;
        farbe+=xxxG;
        farbe+=&quot;,&quot;;
        farbe+=xxxB;
        cout &lt;&lt;farbe;
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1379323</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1379323</guid><dc:creator><![CDATA[NaNoXiD]]></dc:creator><pubDate>Sat, 06 Oct 2007 17:33:35 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel on Sat, 06 Oct 2007 19:25:52 GMT]]></title><description><![CDATA[<p>Du verwendest einen integer in einem string!?! Den musst du doch erst umwandeln...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1379390</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1379390</guid><dc:creator><![CDATA[shell23]]></dc:creator><pubDate>Sat, 06 Oct 2007 19:25:52 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel on Sun, 07 Oct 2007 04:10:40 GMT]]></title><description><![CDATA[<p>Quick &amp; Dirty:</p>
<pre><code class="language-cpp">char buffer[32];

        farbe=itoa(xxxR, buffer, 10);
        farbe+=&quot;,&quot;;
        farbe+=itoa(xxxG, buffer, 10);
        farbe+=&quot;,&quot;;
        farbe+=itoa(xxxB, buffer, 10);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1379510</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1379510</guid><dc:creator><![CDATA[hustbaer]]></dc:creator><pubDate>Sun, 07 Oct 2007 04:10:40 GMT</pubDate></item><item><title><![CDATA[Reply to GetPixel on Sun, 07 Oct 2007 10:11:47 GMT]]></title><description><![CDATA[<p>ok es geht jetzt<br />
vielen dank</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1379573</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1379573</guid><dc:creator><![CDATA[NaNoXiD]]></dc:creator><pubDate>Sun, 07 Oct 2007 10:11:47 GMT</pubDate></item></channel></rss>