<?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[Probleme mit Bitmap-Zeichnen]]></title><description><![CDATA[<p>Moin,</p>
<p>ich habe folgendes Problem:</p>
<p>ich erstelle 2 Fenster mit der gleichen Klasse, sie bekommen per Message ein Bild zugewiesen, das sie per Funktion laden, den RGB-Wert 100/100/100 durchsichtig machen (Regions) und dann bei jedem WM_PAINT das Bild zeichnen.</p>
<p>Alles in allem lässt sich das als Skinning zusammenfassen.</p>
<p>Dabei hielt ich mich an das FLIPCODE-Tutorial.</p>
<p>DAS PROBLEM: Die Regions werden zwar richtig erstellt, allerdings werden die Bitmaps nicht richtig gezeichnet: immer das zuletzt geladene erscheint. Deshalb tippe ich auf ein HDC-Problem</p>
<p>Im Folgenden die wichtigsten Ausschnitte, den aufs wesentliche zusammengeschnitte Code samt Bildern:<br />
<a href="http://hometown.aol.de/HENGE01/Forum/frage.zip" rel="nofollow">http://hometown.aol.de/HENGE01/Forum/frage.zip</a></p>
<pre><code class="language-cpp">LRESULT CALLBACK HauptProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	static HWND hW1;
	static HWND hW2;

	switch(message)
	{
	case WM_CREATE:
		{
			hW1 = CreateWindow(szFiguren, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hWnd, NULL, ((LPCREATESTRUCT)lParam)-&gt;hInstance, NULL);
			SendMessage(hW1, UM_SET_ID, ID_W1, 0);

			hW2 = CreateWindow(szFiguren, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hWnd, NULL, ((LPCREATESTRUCT)lParam)-&gt;hInstance, NULL);
			SendMessage(hW2, UM_SET_ID, ID_W2, 0);

			return(0);
		}
	case WM_SIZE:
		{
			MoveWindow(hW1, 5, 5, 64, 64, true);
			MoveWindow(hW2, 5 + 64 + 5, 5, 64, 64, true);

			return(0);
		}
	//und so weiter
}

//-----------------------------------------------

LRESULT CALLBACK FigurenProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	static HANDLE hFigur;
	static HDC hDCBitmap;

	switch(message)
	{
	case WM_CREATE:
		{
			return(0);
		}
	case UM_SET_ID:
		{
			hDCBitmap = LIAndSOAndCCDC(&amp;hFigur, wParam, hWnd);

			HRGN hRGN = ScanRegion((HBITMAP)hFigur, TRANSPARENTR, TRANSPARENTG, TRANSPARENTB);
			SetWindowRgn(hWnd, hRGN, true);
			DeleteObject(hRGN);

			return(0);
		}
	case WM_PAINT:
		{
			PAINTSTRUCT ps;
			BeginPaint(hWnd, &amp;ps);
			{
				if(!BitBlt(ps.hdc, 0, 0, 64, 64, hDCBitmap, 0, 0, SRCCOPY))
				{
					//fehler
				}
			}
			EndPaint(hWnd, &amp;ps);

			return(0);
		}
	//und so weiter
}

//-----------------------------------------------

HDC LIAndSOAndCCDC(HANDLE *hHandle, int ID, HWND hWnd)
{
	switch(ID)
	{
	case ID_W1:
		{
			*hHandle = LoadImage(GetModuleHandle(NULL), &quot;1.bmp&quot;, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);

			break;
		}
	case ID_W2:
		{
			*hHandle = LoadImage(GetModuleHandle(NULL), &quot;2.bmp&quot;, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);

			break;
		}
	}

	HDC hDC = CreateCompatibleDC(0);

	SelectObject(hDC, *hHandle);

	return(hDC);
}
</code></pre>
<p>Ich hoffe ihr könnt mir helfen,</p>
<p>Euer ItsNotYou</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/126900/probleme-mit-bitmap-zeichnen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Jul 2026 18:14:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/126900.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 19 Nov 2005 18:27:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme mit Bitmap-Zeichnen on Sat, 19 Nov 2005 18:33:26 GMT]]></title><description><![CDATA[<p>Moin,</p>
<p>ich habe folgendes Problem:</p>
<p>ich erstelle 2 Fenster mit der gleichen Klasse, sie bekommen per Message ein Bild zugewiesen, das sie per Funktion laden, den RGB-Wert 100/100/100 durchsichtig machen (Regions) und dann bei jedem WM_PAINT das Bild zeichnen.</p>
<p>Alles in allem lässt sich das als Skinning zusammenfassen.</p>
<p>Dabei hielt ich mich an das FLIPCODE-Tutorial.</p>
<p>DAS PROBLEM: Die Regions werden zwar richtig erstellt, allerdings werden die Bitmaps nicht richtig gezeichnet: immer das zuletzt geladene erscheint. Deshalb tippe ich auf ein HDC-Problem</p>
<p>Im Folgenden die wichtigsten Ausschnitte, den aufs wesentliche zusammengeschnitte Code samt Bildern:<br />
<a href="http://hometown.aol.de/HENGE01/Forum/frage.zip" rel="nofollow">http://hometown.aol.de/HENGE01/Forum/frage.zip</a></p>
<pre><code class="language-cpp">LRESULT CALLBACK HauptProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	static HWND hW1;
	static HWND hW2;

	switch(message)
	{
	case WM_CREATE:
		{
			hW1 = CreateWindow(szFiguren, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hWnd, NULL, ((LPCREATESTRUCT)lParam)-&gt;hInstance, NULL);
			SendMessage(hW1, UM_SET_ID, ID_W1, 0);

			hW2 = CreateWindow(szFiguren, NULL, WS_CHILD | WS_VISIBLE, 0, 0, 0, 0, hWnd, NULL, ((LPCREATESTRUCT)lParam)-&gt;hInstance, NULL);
			SendMessage(hW2, UM_SET_ID, ID_W2, 0);

			return(0);
		}
	case WM_SIZE:
		{
			MoveWindow(hW1, 5, 5, 64, 64, true);
			MoveWindow(hW2, 5 + 64 + 5, 5, 64, 64, true);

			return(0);
		}
	//und so weiter
}

//-----------------------------------------------

LRESULT CALLBACK FigurenProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	static HANDLE hFigur;
	static HDC hDCBitmap;

	switch(message)
	{
	case WM_CREATE:
		{
			return(0);
		}
	case UM_SET_ID:
		{
			hDCBitmap = LIAndSOAndCCDC(&amp;hFigur, wParam, hWnd);

			HRGN hRGN = ScanRegion((HBITMAP)hFigur, TRANSPARENTR, TRANSPARENTG, TRANSPARENTB);
			SetWindowRgn(hWnd, hRGN, true);
			DeleteObject(hRGN);

			return(0);
		}
	case WM_PAINT:
		{
			PAINTSTRUCT ps;
			BeginPaint(hWnd, &amp;ps);
			{
				if(!BitBlt(ps.hdc, 0, 0, 64, 64, hDCBitmap, 0, 0, SRCCOPY))
				{
					//fehler
				}
			}
			EndPaint(hWnd, &amp;ps);

			return(0);
		}
	//und so weiter
}

//-----------------------------------------------

HDC LIAndSOAndCCDC(HANDLE *hHandle, int ID, HWND hWnd)
{
	switch(ID)
	{
	case ID_W1:
		{
			*hHandle = LoadImage(GetModuleHandle(NULL), &quot;1.bmp&quot;, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);

			break;
		}
	case ID_W2:
		{
			*hHandle = LoadImage(GetModuleHandle(NULL), &quot;2.bmp&quot;, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR | LR_LOADFROMFILE);

			break;
		}
	}

	HDC hDC = CreateCompatibleDC(0);

	SelectObject(hDC, *hHandle);

	return(hDC);
}
</code></pre>
<p>Ich hoffe ihr könnt mir helfen,</p>
<p>Euer ItsNotYou</p>
]]></description><link>https://www.c-plusplus.net/forum/post/921623</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/921623</guid><dc:creator><![CDATA[ItsNotYou]]></dc:creator><pubDate>Sat, 19 Nov 2005 18:33:26 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Bitmap-Zeichnen on Sat, 19 Nov 2005 20:31:37 GMT]]></title><description><![CDATA[<p>Wo speicherst Du denn den &quot;hDCBitmap&quot;? Es sieht so aus als ob dies nur <em>eine</em> Variable ist, somit gewinnt immer der Letztere...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/921725</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/921725</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sat, 19 Nov 2005 20:31:37 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Bitmap-Zeichnen on Sun, 20 Nov 2005 09:51:34 GMT]]></title><description><![CDATA[<p>? ich dachte bei solchen procs wird eine art &quot;kopie&quot; für jedes fenster angelegt...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/921968</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/921968</guid><dc:creator><![CDATA[ItsNotYou]]></dc:creator><pubDate>Sun, 20 Nov 2005 09:51:34 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Bitmap-Zeichnen on Sun, 20 Nov 2005 10:00:05 GMT]]></title><description><![CDATA[<p>lol</p>
]]></description><link>https://www.c-plusplus.net/forum/post/921976</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/921976</guid><dc:creator><![CDATA[*lol*]]></dc:creator><pubDate>Sun, 20 Nov 2005 10:00:05 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Bitmap-Zeichnen on Sun, 20 Nov 2005 10:01:15 GMT]]></title><description><![CDATA[<p>was heißt hier &quot;lol&quot;?<br />
entweder nenn sinnvollen komentar oder du verkneifst es dir!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/921978</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/921978</guid><dc:creator><![CDATA[ItsNotYou]]></dc:creator><pubDate>Sun, 20 Nov 2005 10:01:15 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Bitmap-Zeichnen on Sun, 20 Nov 2005 10:02:58 GMT]]></title><description><![CDATA[<p>lern erstmal die c grundlagen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/921980</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/921980</guid><dc:creator><![CDATA[*lol*]]></dc:creator><pubDate>Sun, 20 Nov 2005 10:02:58 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Bitmap-Zeichnen on Sun, 20 Nov 2005 10:22:39 GMT]]></title><description><![CDATA[<p>Wenn Du keine separate Variable für *eine* Variable angegst, dann hast Du halt nur eine und keine zwei Variablen...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/921993</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/921993</guid><dc:creator><![CDATA[Jochen Kalmbach]]></dc:creator><pubDate>Sun, 20 Nov 2005 10:22:39 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Bitmap-Zeichnen on Sun, 20 Nov 2005 19:37:51 GMT]]></title><description><![CDATA[<p><em>lol</em> schrieb:</p>
<blockquote>
<p>lern erstmal die c grundlagen.</p>
</blockquote>
<p>oho, da spricht der meister der zu feige ist, sich zu registrieren</p>
]]></description><link>https://www.c-plusplus.net/forum/post/922562</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/922562</guid><dc:creator><![CDATA[ItsNotYou]]></dc:creator><pubDate>Sun, 20 Nov 2005 19:37:51 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Bitmap-Zeichnen on Sun, 20 Nov 2005 19:43:31 GMT]]></title><description><![CDATA[<p>lol</p>
]]></description><link>https://www.c-plusplus.net/forum/post/922571</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/922571</guid><dc:creator><![CDATA[*lol*]]></dc:creator><pubDate>Sun, 20 Nov 2005 19:43:31 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Bitmap-Zeichnen on Tue, 22 Nov 2005 12:53:06 GMT]]></title><description><![CDATA[<p>ItsNotYou schrieb:</p>
<blockquote>
<p><em>lol</em> schrieb:</p>
<blockquote>
<p>lern erstmal die c grundlagen.</p>
</blockquote>
<p>oho, da spricht der meister der zu feige ist, sich zu registrieren</p>
</blockquote>
<p>Einfach ignorieren. Wenn jemand schon lol heisst... ;-).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/924258</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/924258</guid><dc:creator><![CDATA[nemeses]]></dc:creator><pubDate>Tue, 22 Nov 2005 12:53:06 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Bitmap-Zeichnen on Sun, 27 Nov 2005 14:33:27 GMT]]></title><description><![CDATA[<p>lol du bis plöd<br />
leg dir erst mal nen richtigen nick zu</p>
<p>und damit ich ontopic bleib: kennt einer vlt ein tutorial zu bitmaps zeichen + winapi?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/928373</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/928373</guid><dc:creator><![CDATA[*rofl*]]></dc:creator><pubDate>Sun, 27 Nov 2005 14:33:27 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit Bitmap-Zeichnen on Sun, 27 Nov 2005 16:43:09 GMT]]></title><description><![CDATA[<p><a href="http://win-api.de" rel="nofollow">http://win-api.de</a><br />
Für die WinApi.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/928465</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/928465</guid><dc:creator><![CDATA[misterzylinder]]></dc:creator><pubDate>Sun, 27 Nov 2005 16:43:09 GMT</pubDate></item></channel></rss>