<?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[Backbuffer schmirt ab!]]></title><description><![CDATA[<p>Ich habe einen kleinen Backbuffer (ein DC) auf dem ich dieganze zeit alles drauf zeichne. Wenn alles drauf gezeichnet ist, übertrage ich den Backbuffer auf mein FensterDC! Das problem ist nun, das nach einer weile nicht mehr gezeichnet wird, obwohl ich alle Ojecte etc. lösche!</p>
<pre><code class="language-cpp">HPEN hPen1;
			HPEN hPen2;
			HBRUSH hBrush1;
			SDSPAINT.hBackbufferDC = CreateCompatibleDC(NULL);
			SDSWINDOWSTRICK[iInternWindow].strWindow.hDC = BeginPaint(SDSWINDOWSTRICK[iInternWindow].strWindow.hWindow, &amp;SDSPAINT.psPaintstruct);
			SDSPAINT.hbBBNew = CreateCompatibleBitmap(SDSWINDOWSTRICK[iInternWindow].strWindow.hDC,SDSWINDOWSTRICK[iInternWindow].iWidth, SDSWINDOWSTRICK[iInternWindow].iHeight);
			SelectObject(SDSPAINT.hBackbufferDC, SDSPAINT.hbBBNew);

			SelectObject(SDSPAINT.hBackbufferDC, hPen1 = CreatePen(PS_SOLID, 1, RGB(0,0,0)));
			SelectObject(SDSPAINT.hBackbufferDC, hBrush1 = CreateSolidBrush(RGB(63,63,63)));
			Rectangle(SDSPAINT.hBackbufferDC, 0, 0, SDSWINDOWSTRICK[iInternWindow].iWidth, SDSWINDOWSTRICK[iInternWindow].iHeight);
			SelectObject(SDSPAINT.hBackbufferDC, hPen2 = CreatePen(PS_SOLID, 1, RGB(192,192,192)));
			Rectangle(SDSPAINT.hBackbufferDC, 1, 1, SDSWINDOWSTRICK[iInternWindow].iWidth-1, SDSWINDOWSTRICK[iInternWindow].iHeight-1);

			BitBlt(SDSWINDOWSTRICK[iInternWindow].strWindow.hDC, 0, 0, SDSWINDOWSTRICK[iInternWindow].iWidth, SDSWINDOWSTRICK[iInternWindow].iHeight, SDSPAINT.hBackbufferDC, 0, 0, SRCCOPY);
			DeleteObject(hPen1);
			DeleteObject(hPen2);
			DeleteObject(hBrush1);
			SDSWINDOWSTRICK[iInternWindow].strWindow.hDC = NULL;
			SDSPAINT.hBackbufferDC = NULL;
			DeleteDC(SDSWINDOWSTRICK[iInternWindow].strWindow.hDC);
			DeleteDC(SDSPAINT.hBackbufferDC);
			DeleteObject(SDSPAINT.hbBBNew); 
			EndPaint(SDSWINDOWSTRICK[iInternWindow].strWindow.hWindow, &amp;SDSPAINT.psPaintstruct);
</code></pre>
<p>Nunja, ich weiß nicht mehr weiter <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/topic/220849/backbuffer-schmirt-ab</link><generator>RSS for Node</generator><lastBuildDate>Mon, 13 Apr 2026 08:05:48 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/220849.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 21 Aug 2008 21:52:29 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Backbuffer schmirt ab! on Thu, 21 Aug 2008 22:07:41 GMT]]></title><description><![CDATA[<p>Ich habe einen kleinen Backbuffer (ein DC) auf dem ich dieganze zeit alles drauf zeichne. Wenn alles drauf gezeichnet ist, übertrage ich den Backbuffer auf mein FensterDC! Das problem ist nun, das nach einer weile nicht mehr gezeichnet wird, obwohl ich alle Ojecte etc. lösche!</p>
<pre><code class="language-cpp">HPEN hPen1;
			HPEN hPen2;
			HBRUSH hBrush1;
			SDSPAINT.hBackbufferDC = CreateCompatibleDC(NULL);
			SDSWINDOWSTRICK[iInternWindow].strWindow.hDC = BeginPaint(SDSWINDOWSTRICK[iInternWindow].strWindow.hWindow, &amp;SDSPAINT.psPaintstruct);
			SDSPAINT.hbBBNew = CreateCompatibleBitmap(SDSWINDOWSTRICK[iInternWindow].strWindow.hDC,SDSWINDOWSTRICK[iInternWindow].iWidth, SDSWINDOWSTRICK[iInternWindow].iHeight);
			SelectObject(SDSPAINT.hBackbufferDC, SDSPAINT.hbBBNew);

			SelectObject(SDSPAINT.hBackbufferDC, hPen1 = CreatePen(PS_SOLID, 1, RGB(0,0,0)));
			SelectObject(SDSPAINT.hBackbufferDC, hBrush1 = CreateSolidBrush(RGB(63,63,63)));
			Rectangle(SDSPAINT.hBackbufferDC, 0, 0, SDSWINDOWSTRICK[iInternWindow].iWidth, SDSWINDOWSTRICK[iInternWindow].iHeight);
			SelectObject(SDSPAINT.hBackbufferDC, hPen2 = CreatePen(PS_SOLID, 1, RGB(192,192,192)));
			Rectangle(SDSPAINT.hBackbufferDC, 1, 1, SDSWINDOWSTRICK[iInternWindow].iWidth-1, SDSWINDOWSTRICK[iInternWindow].iHeight-1);

			BitBlt(SDSWINDOWSTRICK[iInternWindow].strWindow.hDC, 0, 0, SDSWINDOWSTRICK[iInternWindow].iWidth, SDSWINDOWSTRICK[iInternWindow].iHeight, SDSPAINT.hBackbufferDC, 0, 0, SRCCOPY);
			DeleteObject(hPen1);
			DeleteObject(hPen2);
			DeleteObject(hBrush1);
			SDSWINDOWSTRICK[iInternWindow].strWindow.hDC = NULL;
			SDSPAINT.hBackbufferDC = NULL;
			DeleteDC(SDSWINDOWSTRICK[iInternWindow].strWindow.hDC);
			DeleteDC(SDSPAINT.hBackbufferDC);
			DeleteObject(SDSPAINT.hbBBNew); 
			EndPaint(SDSWINDOWSTRICK[iInternWindow].strWindow.hWindow, &amp;SDSPAINT.psPaintstruct);
</code></pre>
<p>Nunja, ich weiß nicht mehr weiter <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/1569243</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1569243</guid><dc:creator><![CDATA[Code-Walker]]></dc:creator><pubDate>Thu, 21 Aug 2008 22:07:41 GMT</pubDate></item><item><title><![CDATA[Reply to Backbuffer schmirt ab! on Fri, 22 Aug 2008 10:13:45 GMT]]></title><description><![CDATA[<p>GDI-Objekte können nur gelöscht werden, wenn sie sich nicht mehr innerhalb eines DCs befinden. Deshalb müssen die vorherigen Objekte abschließend wieder in den DC zurückgewählt werden.</p>
<pre><code class="language-cpp">HBRUSH hBrush = CreateSolidBrush(RGB(0, 0, 0));
HBRUSH hOldBrush = static_cast&lt;HBRUSH&gt;(SelectObject(SDSPAINT.hBackbufferDC, hBrush1));

...

SelectObject(SDSPAINT.hBackbufferDC, hOldBrush);
DeleteObject(hBrush);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1569504</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1569504</guid><dc:creator><![CDATA[sri]]></dc:creator><pubDate>Fri, 22 Aug 2008 10:13:45 GMT</pubDate></item><item><title><![CDATA[Reply to Backbuffer schmirt ab! on Sat, 23 Aug 2008 11:05:13 GMT]]></title><description><![CDATA[<p>Danke, da hat mir chonmal ehr geholfen, ich hab das nun bei allen Objekten gemacht, nur chmirt e immernoch ab, es dauert nur halt länger bis es soweit ist <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":/"
      alt="😕"
    /></p>
<pre><code class="language-cpp">SDSPAINT.hBackbufferDC = CreateCompatibleDC(NULL);
			SDSWINDOWSTRICK[iInternWindow].strWindow.hDC = BeginPaint(SDSWINDOWSTRICK[iInternWindow].strWindow.hWindow, &amp;SDSPAINT.psPaintstruct);
			SDSPAINT.hbBBNew = CreateCompatibleBitmap(SDSWINDOWSTRICK[iInternWindow].strWindow.hDC,SDSWINDOWSTRICK[iInternWindow].iWidth, SDSWINDOWSTRICK[iInternWindow].iHeight);
			SDSPAINT.hbBBOld = static_cast&lt;HBITMAP&gt;(SelectObject(SDSPAINT.hBackbufferDC, SDSPAINT.hbBBNew));

			HPEN hPen1 = CreatePen(PS_SOLID, 1, RGB(0,0,0));
			HPEN hOldPen1 = static_cast&lt;HPEN&gt;(SelectObject(SDSPAINT.hBackbufferDC, hPen1));
			HBRUSH hBrush1 = CreateSolidBrush(RGB(63,63,63));
			HBRUSH hOldBrush1 = static_cast&lt;HBRUSH&gt;(SelectObject(SDSPAINT.hBackbufferDC, hBrush1));
			Rectangle(SDSPAINT.hBackbufferDC, 0, 0, SDSWINDOWSTRICK[iInternWindow].iWidth, SDSWINDOWSTRICK[iInternWindow].iHeight);
			HPEN hPen2 = CreatePen(PS_SOLID, 1, RGB(192,192,192));
			HPEN hOldPen2 = static_cast&lt;HPEN&gt;(SelectObject(SDSPAINT.hBackbufferDC, hPen2));
			Rectangle(SDSPAINT.hBackbufferDC, 1, 1, SDSWINDOWSTRICK[iInternWindow].iWidth-1, SDSWINDOWSTRICK[iInternWindow].iHeight-1);

			BitBlt(SDSWINDOWSTRICK[iInternWindow].strWindow.hDC, 0, 0, SDSWINDOWSTRICK[iInternWindow].iWidth, SDSWINDOWSTRICK[iInternWindow].iHeight, SDSPAINT.hBackbufferDC, 0, 0, SRCCOPY);

			SelectObject(SDSPAINT.hBackbufferDC, hOldBrush1);
			DeleteObject(hBrush1);
			SelectObject(SDSPAINT.hBackbufferDC, hOldPen1);
			DeleteObject(hPen1);
			SelectObject(SDSPAINT.hBackbufferDC, hOldPen2);
			DeleteObject(hPen2);
			SelectObject(SDSPAINT.hBackbufferDC, SDSPAINT.hbBBOld); 
			DeleteObject(SDSPAINT.hbBBNew);

			SDSWINDOWSTRICK[iInternWindow].strWindow.hDC = NULL;
			SDSPAINT.hBackbufferDC = NULL;
			DeleteDC(SDSWINDOWSTRICK[iInternWindow].strWindow.hDC);
			DeleteDC(SDSPAINT.hBackbufferDC); 
			EndPaint(SDSWINDOWSTRICK[iInternWindow].strWindow.hWindow, &amp;SDSPAINT.psPaintstruct);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1570012</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1570012</guid><dc:creator><![CDATA[Code-Walker]]></dc:creator><pubDate>Sat, 23 Aug 2008 11:05:13 GMT</pubDate></item><item><title><![CDATA[Reply to Backbuffer schmirt ab! on Sat, 23 Aug 2008 15:38:50 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">// DeleteDC(SDSWINDOWSTRICK[iInternWindow].strWindow.hDC);
DeleteDC(SDSPAINT.hBackbufferDC); 
EndPaint(SDSWINDOWSTRICK[iInternWindow].strWindow.hWindow, &amp;SDSPAINT.psPaintstruct);

SDSWINDOWSTRICK[iInternWindow].strWindow.hDC = NULL;
SDSPAINT.hBackbufferDC = NULL;
</code></pre>
<p>SDSWINDOWSTRICK[iInternWindow].strWindow.hDC braucht nicht gelöscht zu werden. SDSPAINT.hBackbufferDC erst löschen und dann nullen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1570147</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1570147</guid><dc:creator><![CDATA[sri]]></dc:creator><pubDate>Sat, 23 Aug 2008 15:38:50 GMT</pubDate></item><item><title><![CDATA[Reply to Backbuffer schmirt ab! on Sat, 23 Aug 2008 15:46:05 GMT]]></title><description><![CDATA[<p>Ja, habe ich auch gerade heraus bekommen <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<p>Das peoblem ist, das ich funktionen habe die alle etwas in de backbuffer zeichnen. Also kann ich den Backbuffer erst im nachhinein löschen, da erst am ende einer ganz anderen funktion der backbuffer auf das fensterDC übertragen wird <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":/"
      alt="😕"
    /></p>
<p>EDIT::::</p>
<p>Dies hat ungefair diese struktur:</p>
<pre><code class="language-cpp">void a()
{
    //zeichne viereck
}

void b()
{
    //zeichne dreieck
}

void c()
{
    // zeichne kreis
}

void d()
{
    // übertrage backbuffer auf fensterDC
}
</code></pre>
<p>Ic müsste in den einzelnen fnktionen die objekte löschen können!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1570152</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1570152</guid><dc:creator><![CDATA[Code-Walker]]></dc:creator><pubDate>Sat, 23 Aug 2008 15:46:05 GMT</pubDate></item><item><title><![CDATA[Reply to Backbuffer schmirt ab! on Sat, 23 Aug 2008 15:48:40 GMT]]></title><description><![CDATA[<p>Dann musst Du den DC eben erst am Ende löschen. Der von Dir gepostete Code</p>
<pre><code class="language-cpp">SDSPAINT.hBackbufferDC = NULL; 
DeleteDC(SDSPAINT.hBackbufferDC);
</code></pre>
<p>verursacht aber definitiv einen GDI-Leak, weil der DC schon vor dem Löschen genullt wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1570156</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1570156</guid><dc:creator><![CDATA[sri]]></dc:creator><pubDate>Sat, 23 Aug 2008 15:48:40 GMT</pubDate></item><item><title><![CDATA[Reply to Backbuffer schmirt ab! on Sat, 23 Aug 2008 15:55:44 GMT]]></title><description><![CDATA[<p>Ich dachte der müsste immer vor dem löschen der objekte gelöscht werden?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1570161</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1570161</guid><dc:creator><![CDATA[Code-Walker]]></dc:creator><pubDate>Sat, 23 Aug 2008 15:55:44 GMT</pubDate></item><item><title><![CDATA[Reply to Backbuffer schmirt ab! on Sat, 23 Aug 2008 16:09:15 GMT]]></title><description><![CDATA[<p>Nein. Es können nur keine Objekte gelöscht werden, wenn sie sich noch in einem DC befinden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1570172</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1570172</guid><dc:creator><![CDATA[sri]]></dc:creator><pubDate>Sat, 23 Aug 2008 16:09:15 GMT</pubDate></item></channel></rss>