<?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[return 0;]]></title><description><![CDATA[<p>hallo zusammen,</p>
<p>der folgende Code ist von msdn. Aber er funktioniert nur, wenn ich die &quot;return 0L;&quot; als Kommentar korrigiere. Wer kann mir detailliert erklären, was nach &quot;return 0L;&quot; dann passiert? dank vorher!</p>
<pre><code>RECT rc; 
HDC hdc;
PAINTSTRUCT ps;
POINT aptPentagon[6] =
            {50,2, 98,35, 79,90, 21,90, 2,35, 50,2 },
      aptHexagon[7]  =
            {50,2, 93,25, 93,75, 50,98, 7,75, 7,25, 50,2 };
POINT* ppt = aptPentagon;
int cpt = 6;

    switch (message)
     {
      case WM_CHAR : 
        switch (wParam) 
         {
          case '5' :
            ppt = aptPentagon; 
            cpt = 6; 
            break; 
          case '6' :
            ppt = aptHexagon; 
            cpt = 7; 
            break; 
         }
        InvalidateRect(hwnd, NULL, TRUE);
/***************************************************
        // return 0L;
***************************************************/

      case WM_PAINT :
        hdc = BeginPaint(hwnd, &amp;ps);

        GetClientRect(hwnd, &amp;rc); 
        SetMapMode(hdc, MM_ANISOTROPIC); 
        SetWindowExtEx(hdc, 100, 100, NULL); 
        SetViewportExtEx(hdc, rc.right, rc.bottom, NULL);

        Polyline(hdc, ppt, cpt); 
        EndPaint(hwnd, &amp;ps);return 0;
     }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/208682/return-0</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Apr 2026 01:09:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/208682.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 21 Mar 2008 10:38:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to return 0; on Fri, 21 Mar 2008 10:38:17 GMT]]></title><description><![CDATA[<p>hallo zusammen,</p>
<p>der folgende Code ist von msdn. Aber er funktioniert nur, wenn ich die &quot;return 0L;&quot; als Kommentar korrigiere. Wer kann mir detailliert erklären, was nach &quot;return 0L;&quot; dann passiert? dank vorher!</p>
<pre><code>RECT rc; 
HDC hdc;
PAINTSTRUCT ps;
POINT aptPentagon[6] =
            {50,2, 98,35, 79,90, 21,90, 2,35, 50,2 },
      aptHexagon[7]  =
            {50,2, 93,25, 93,75, 50,98, 7,75, 7,25, 50,2 };
POINT* ppt = aptPentagon;
int cpt = 6;

    switch (message)
     {
      case WM_CHAR : 
        switch (wParam) 
         {
          case '5' :
            ppt = aptPentagon; 
            cpt = 6; 
            break; 
          case '6' :
            ppt = aptHexagon; 
            cpt = 7; 
            break; 
         }
        InvalidateRect(hwnd, NULL, TRUE);
/***************************************************
        // return 0L;
***************************************************/

      case WM_PAINT :
        hdc = BeginPaint(hwnd, &amp;ps);

        GetClientRect(hwnd, &amp;rc); 
        SetMapMode(hdc, MM_ANISOTROPIC); 
        SetWindowExtEx(hdc, 100, 100, NULL); 
        SetViewportExtEx(hdc, rc.right, rc.bottom, NULL);

        Polyline(hdc, ppt, cpt); 
        EndPaint(hwnd, &amp;ps);return 0;
     }
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1478221</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1478221</guid><dc:creator><![CDATA[damo]]></dc:creator><pubDate>Fri, 21 Mar 2008 10:38:17 GMT</pubDate></item><item><title><![CDATA[Reply to return 0; on Fri, 21 Mar 2008 10:49:18 GMT]]></title><description><![CDATA[<p>Hi, das</p>
<pre><code class="language-cpp">return 0L;
</code></pre>
<p>solltest du schon unkommentiert stehen lassen. Durch</p>
<pre><code class="language-cpp">InvalidateRect (hwnd, NULL, TRUE) ;
</code></pre>
<p>wird sowieso WM_PAINT geschickt und ein Fall Through ist hier unnötig bzw. es würde dann zweimal der WM_PAINT-Block ausgeführt werden.</p>
<p>Was genau meinst du denn damit, dass es nicht funktioniert? Wird nichts gezeichnet auf Drücken von &quot;5&quot; oder &quot;6&quot;?</p>
<p>MfG WilMen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1478230</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1478230</guid><dc:creator><![CDATA[WilMen]]></dc:creator><pubDate>Fri, 21 Mar 2008 10:49:18 GMT</pubDate></item><item><title><![CDATA[Reply to return 0; on Fri, 21 Mar 2008 11:00:45 GMT]]></title><description><![CDATA[<p>dank für Antwort.</p>
<p>wenn ich das &quot;return 0L;&quot; unkommentiert (original von msdn) stehen lasse, wird nichts gezeichnet auf Drücken von &quot;5&quot; oder &quot;6&quot;.</p>
<p>deshalb verstehe ich auch nicht, wieso funktioniert das InvalidateRect nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1478235</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1478235</guid><dc:creator><![CDATA[damo]]></dc:creator><pubDate>Fri, 21 Mar 2008 11:00:45 GMT</pubDate></item><item><title><![CDATA[Reply to return 0; on Fri, 21 Mar 2008 11:48:56 GMT]]></title><description><![CDATA[<p>damo schrieb:</p>
<blockquote>
<p>wieso funktioniert das InvalidateRect nicht</p>
</blockquote>
<p>Das InvalidateRect funktioniert schon korrekt.</p>
<p>Aber das, was InvalidateRect macht, wird erst &quot;sichtbar&quot; wenn die Anwendung ein WM_PAINT verarbeitet.</p>
<p>Probier mal folgendes :</p>
<pre><code class="language-cpp">case WM_CHAR : 
  (...)
  InvalidateRect(hwnd, NULL, TRUE);
  UpdateWindow  (hwnd);            // &lt;- ein WM_PAINT auslösen via UpdateWindow
  return 0L;                       // &lt;- muß bleiben
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1478267</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1478267</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Fri, 21 Mar 2008 11:48:56 GMT</pubDate></item><item><title><![CDATA[Reply to return 0; on Fri, 21 Mar 2008 11:56:14 GMT]]></title><description><![CDATA[<p>@merker</p>
<p>danke sehr, aber es geht wieder nicht...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1478268</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1478268</guid><dc:creator><![CDATA[damo]]></dc:creator><pubDate>Fri, 21 Mar 2008 11:56:14 GMT</pubDate></item><item><title><![CDATA[Reply to return 0; on Fri, 21 Mar 2008 12:12:11 GMT]]></title><description><![CDATA[<p>Oh, Du mußt das &quot;case WM_CHAR&quot; noch in geschweifte Klammern setzen :</p>
<pre><code class="language-cpp">case WM_CHAR : 
 { // &lt;- !
   switch (wParam)
   {
    case '5' :
    (...)    
     break;       // &lt;- sonst würde er hier schon aus der &quot;switch (message)&quot; springen
    case '6' :    //    und erreicht InvalidateRect gar nicht erst
    (...)
     break;       // &lt;- oder hier
   }

   InvalidateRect(hwnd, NULL, TRUE);
   UpdateWindow  (hwnd);  
   return 0L; 
 } // &lt;- !
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1478276</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1478276</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Fri, 21 Mar 2008 12:12:11 GMT</pubDate></item><item><title><![CDATA[Reply to return 0; on Fri, 21 Mar 2008 12:53:27 GMT]]></title><description><![CDATA[<p>haha, ich weiss jetzt, was die Probleme sind:</p>
<pre><code>POINT aptPentagon[6] =
            {50,2, 98,35, 79,90, 21,90, 2,35, 50,2 },
      aptHexagon[7]  =
            {50,2, 93,25, 93,75, 50,98, 7,75, 7,25, 50,2 };
POINT *ppt = aptPentagon;
int cpt = 6;
</code></pre>
<p>die 3 Variablen müssen als <strong>global</strong> definiert werden!<br />
(hab früher nicht die komplette Codes gegeben, Entschuldigung!)</p>
<p>Ansonst, obwohl das WndProc die WM_PAINT von InvalidateRect bekommt, werden die 3 Variablen wieder neu definiert/initialisiert! (also dass ppt immer auf aptPentagon zeigt &amp; cpt immer gleich 6 ist)</p>
<p>ich danke euch noch mal.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1478286</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1478286</guid><dc:creator><![CDATA[damo]]></dc:creator><pubDate>Fri, 21 Mar 2008 12:53:27 GMT</pubDate></item><item><title><![CDATA[Reply to return 0; on Fri, 21 Mar 2008 12:38:22 GMT]]></title><description><![CDATA[<p>Oweh, beachte meinen zweiten Beitrag bloß nicht. Der ist völliger Blödsinn. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f62e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_open_mouth"
      title=":open_mouth:"
      alt="😮"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1478289</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1478289</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Fri, 21 Mar 2008 12:38:22 GMT</pubDate></item></channel></rss>