<?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[DeleteObject nach DeleteDC noch notwendig?]]></title><description><![CDATA[<p>Huhu!<br />
Hab mal ne kleine Frage an die GDI experten unter euch...</p>
<p>Angenommen ich habe folgendes gemacht:</p>
<pre><code>HDC hFontBitmapDC = CreateCompatibleDC(hdc);
	HBITMAP hFontBitmap = LoadBitmap(hInstance, BitmapPath);
	HBITMAP hOld = SelectBitmap(hFontBitmapDC, hFontBitmap);
	DeleteObject(hOld);

	...
	//Blitten
	BitBlt(hdc, xPos, yPos, iZeichenBreite, iZeichenHoehe, hFontBitmapDC, xKoord, yKoord, SRCCOPY);
</code></pre>
<p>Nun muss ich ja nach dem Blitten aufräumen. Ich habe ja nun noch das Bitmap selbst (hFontBitmap) und den Gerätekontext auf dieses (hFontBitmapDC). Wird beim Aufruf von DeleteDC(hFontBitmapDC) das Bitmap ebenfalls gelöscht, oder muss ich das nachträglich noch per DeleteObject(hFontBitmap) erledigen?</p>
<p>mfg Perner</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/219811/deleteobject-nach-deletedc-noch-notwendig</link><generator>RSS for Node</generator><lastBuildDate>Tue, 14 Apr 2026 07:14:49 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/219811.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 07 Aug 2008 21:16:24 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to DeleteObject nach DeleteDC noch notwendig? on Thu, 07 Aug 2008 21:16:24 GMT]]></title><description><![CDATA[<p>Huhu!<br />
Hab mal ne kleine Frage an die GDI experten unter euch...</p>
<p>Angenommen ich habe folgendes gemacht:</p>
<pre><code>HDC hFontBitmapDC = CreateCompatibleDC(hdc);
	HBITMAP hFontBitmap = LoadBitmap(hInstance, BitmapPath);
	HBITMAP hOld = SelectBitmap(hFontBitmapDC, hFontBitmap);
	DeleteObject(hOld);

	...
	//Blitten
	BitBlt(hdc, xPos, yPos, iZeichenBreite, iZeichenHoehe, hFontBitmapDC, xKoord, yKoord, SRCCOPY);
</code></pre>
<p>Nun muss ich ja nach dem Blitten aufräumen. Ich habe ja nun noch das Bitmap selbst (hFontBitmap) und den Gerätekontext auf dieses (hFontBitmapDC). Wird beim Aufruf von DeleteDC(hFontBitmapDC) das Bitmap ebenfalls gelöscht, oder muss ich das nachträglich noch per DeleteObject(hFontBitmap) erledigen?</p>
<p>mfg Perner</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1561156</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1561156</guid><dc:creator><![CDATA[Perner]]></dc:creator><pubDate>Thu, 07 Aug 2008 21:16:24 GMT</pubDate></item><item><title><![CDATA[Reply to DeleteObject nach DeleteDC noch notwendig? on Thu, 07 Aug 2008 21:23:14 GMT]]></title><description><![CDATA[<p>Wie Windows das intern handhabt weiß kein Mensch, vermutlich bei M$ auch nicht.<br />
Logisch wäre, alle GDI-Objekte aus dem DC zu löschen bevor der den finalen<br />
Gnadenschuß erhält.</p>
<p>So ähnlich wie malloc(), wech is wech. Sauber programmiert gibt man den frei .</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1561160</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1561160</guid><dc:creator><![CDATA[Scheppertreiber]]></dc:creator><pubDate>Thu, 07 Aug 2008 21:23:14 GMT</pubDate></item><item><title><![CDATA[Reply to DeleteObject nach DeleteDC noch notwendig? on Fri, 08 Aug 2008 06:38:32 GMT]]></title><description><![CDATA[<p>Nein! Diese Bitmap wird nicht entsorgt!</p>
<p>Dein Code ist falsch.<br />
Lösche nicht die alte Bitmap, die Du einselektierst. Merke sie Dir einfach und selektiere sie zurück bevor Du den DC entsorgst.</p>
<pre><code class="language-cpp">HDC hFontBitmapDC = CreateCompatibleDC(hdc);
    HBITMAP hFontBitmap = LoadBitmap(hInstance, BitmapPath);
    HBITMAP hOld = SelectObject(hFontBitmapDC, hFontBitmap);
    ...
    //Blitten
    BitBlt(hdc, xPos, yPos, iZeichenBreite, iZeichenHoehe, hFontBitmapDC, xKoord, yKoord, SRCCOPY); 

    // Aufräumen
    SelectObject(hFontBitmapDC, hOld);
    DeleteDC(hFontBitmapDC);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1561232</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1561232</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Fri, 08 Aug 2008 06:38:32 GMT</pubDate></item></channel></rss>