<?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[Problem mit BitBlt und CreateBitmapIndirect]]></title><description><![CDATA[<p>Hi Leute!<br />
Ich habe ein Problem mit dem anzeigen von Bitmaps, die ich selbst berechne.<br />
Hier ist der Code, der bei WM_PAINT hauptsächlich ausgeführt wird:</p>
<pre><code class="language-cpp">HDC hDcWnd= GetDC(hWindow);
	if(!hDcWnd)
		GT_ERROR_WIN(TEXT(&quot;GetDC(hWindow);&quot;), GetLastError());

	BITMAP Bitmap;
	Bitmap.bmType= 0;
	Bitmap.bmWidth= AmGenerator.GetBmpWidth();
	Bitmap.bmHeight= AmGenerator.GetBmpHeight();
	Bitmap.bmWidthBytes= sizeof(DWORD) * AmGenerator.GetBmpWidth();
	Bitmap.bmPlanes= 1;
	Bitmap.bmBitsPixel= sizeof(DWORD);
	Bitmap.bmBits= AmGenerator.GetBitmapData();

	HBITMAP hBitmap= CreateBitmapIndirect(&amp;Bitmap);
	if(!hBitmap)
		GT_ERROR_WIN(TEXT(&quot;CreateBitmapIndirect(&amp;Bitmap);&quot;), GetLastError());	

	HDC hDcBitmap= CreateCompatibleDC(hDcWnd);
	if(!hDcBitmap)
		GT_ERROR_WIN(TEXT(&quot;CreateCompatibleDC(hDcWnd);&quot;), GetLastError());

	SelectObject(hDcBitmap, hBitmap);

	BitBlt(hDcWnd, 0, 0, AmGenerator.GetBmpWidth(), AmGenerator.GetBmpHeight(),
		hDcBitmap, 0, 0, SRCCOPY);

	DeleteDC(hDcBitmap);
	DeleteObject(hBitmap);
	ReleaseDC(hWindow, hDcWnd);
</code></pre>
<p>Sieht einer von Euch auf Anhieb den Fehler?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/228055/problem-mit-bitblt-und-createbitmapindirect</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 22:28:40 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/228055.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 23 Nov 2008 13:49:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit BitBlt und CreateBitmapIndirect on Sun, 23 Nov 2008 13:49:05 GMT]]></title><description><![CDATA[<p>Hi Leute!<br />
Ich habe ein Problem mit dem anzeigen von Bitmaps, die ich selbst berechne.<br />
Hier ist der Code, der bei WM_PAINT hauptsächlich ausgeführt wird:</p>
<pre><code class="language-cpp">HDC hDcWnd= GetDC(hWindow);
	if(!hDcWnd)
		GT_ERROR_WIN(TEXT(&quot;GetDC(hWindow);&quot;), GetLastError());

	BITMAP Bitmap;
	Bitmap.bmType= 0;
	Bitmap.bmWidth= AmGenerator.GetBmpWidth();
	Bitmap.bmHeight= AmGenerator.GetBmpHeight();
	Bitmap.bmWidthBytes= sizeof(DWORD) * AmGenerator.GetBmpWidth();
	Bitmap.bmPlanes= 1;
	Bitmap.bmBitsPixel= sizeof(DWORD);
	Bitmap.bmBits= AmGenerator.GetBitmapData();

	HBITMAP hBitmap= CreateBitmapIndirect(&amp;Bitmap);
	if(!hBitmap)
		GT_ERROR_WIN(TEXT(&quot;CreateBitmapIndirect(&amp;Bitmap);&quot;), GetLastError());	

	HDC hDcBitmap= CreateCompatibleDC(hDcWnd);
	if(!hDcBitmap)
		GT_ERROR_WIN(TEXT(&quot;CreateCompatibleDC(hDcWnd);&quot;), GetLastError());

	SelectObject(hDcBitmap, hBitmap);

	BitBlt(hDcWnd, 0, 0, AmGenerator.GetBmpWidth(), AmGenerator.GetBmpHeight(),
		hDcBitmap, 0, 0, SRCCOPY);

	DeleteDC(hDcBitmap);
	DeleteObject(hBitmap);
	ReleaseDC(hWindow, hDcWnd);
</code></pre>
<p>Sieht einer von Euch auf Anhieb den Fehler?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619342</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619342</guid><dc:creator><![CDATA[Blaze]]></dc:creator><pubDate>Sun, 23 Nov 2008 13:49:05 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit BitBlt und CreateBitmapIndirect on Sun, 23 Nov 2008 15:34:30 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich würde CreateCompatibleBitmap vorziehen. Es mit Länge und Breite versehen. Anschließend füttern, so wie Du beschreibst.<br />
Dieses dann mit SelectObject( ... ) in den Gerätekontext einspeisen.</p>
<p>Die MSDN weist übrigens ausdrücklich darauf hin, dass man mit CreateBitmapIndirect eher monochrome Bitmaps erzeugen lassen soll und farbige besser mit der og Funktion.</p>
<p>Hast Du geprüft, ob von dem AmGenerator-Object auch tatsächlich brauchbare Daten kommen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1619430</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1619430</guid><dc:creator><![CDATA[CStern]]></dc:creator><pubDate>Sun, 23 Nov 2008 15:34:30 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit BitBlt und CreateBitmapIndirect on Tue, 25 Nov 2008 17:55:54 GMT]]></title><description><![CDATA[<p>Vom AmGenerator kommen die richtigen Daten, der kann die Daten auch direkt in Bitmap-Dateien speichern. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /><br />
Ich benutze jetzt CreateDibSection, das läuft problemlos.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1620653</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1620653</guid><dc:creator><![CDATA[Blaze]]></dc:creator><pubDate>Tue, 25 Nov 2008 17:55:54 GMT</pubDate></item></channel></rss>