<?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 MemoryDC]]></title><description><![CDATA[<p>Hi,<br />
also: ich habe diesen code geschrieben:</p>
<pre><code>HBITMAP hBmp;
	CString cFilename;

	dcFontDC.CreateCompatibleDC(NULL);

	cFilename = &quot;c:\\Bild.bmp&quot;;
	hBmp = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(), cFilename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);

	DrawTransparent(&amp;dcFontDC, hBmp, 0, 0, BildSize_X, BildSize_Y);	    // (selber geschrieben, funktioniert auch)	

	COLORREF Pixel = dcFontDC.GetPixel(0,0);
</code></pre>
<p>jetzt müsste ich doch eingentlich mit 'GetRValue(Pixel)', 'GetGValue(Pixel)' und 'GetBValue(Pixel)' die einzelnen pixel abfragen können.<br />
das hab ich zum testen gemacht, aber er zeigt mir immer 255,255,255 an. das ist die farbe für SetBkColor(RGB(255,255,255)) in der 'DrawTransparent(...)' -funktion.</p>
<p>also hat er das bitmap nicht gemalt sondern nur das feld für die angegeben maße; oder <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=":confused:"
      alt="😕"
    /><br />
ich habe das bild schon auf meinem normalen dialogfeld gemalt und es hat geklappt.</p>
<p>kann mir jemand helfen ??<br />
mfg RedSkall</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/58824/problem-mit-memorydc</link><generator>RSS for Node</generator><lastBuildDate>Wed, 03 Jun 2026 00:18:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/58824.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 16 Dec 2003 14:19:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem mit MemoryDC on Tue, 16 Dec 2003 14:19:05 GMT]]></title><description><![CDATA[<p>Hi,<br />
also: ich habe diesen code geschrieben:</p>
<pre><code>HBITMAP hBmp;
	CString cFilename;

	dcFontDC.CreateCompatibleDC(NULL);

	cFilename = &quot;c:\\Bild.bmp&quot;;
	hBmp = (HBITMAP) ::LoadImage(AfxGetInstanceHandle(), cFilename, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION);

	DrawTransparent(&amp;dcFontDC, hBmp, 0, 0, BildSize_X, BildSize_Y);	    // (selber geschrieben, funktioniert auch)	

	COLORREF Pixel = dcFontDC.GetPixel(0,0);
</code></pre>
<p>jetzt müsste ich doch eingentlich mit 'GetRValue(Pixel)', 'GetGValue(Pixel)' und 'GetBValue(Pixel)' die einzelnen pixel abfragen können.<br />
das hab ich zum testen gemacht, aber er zeigt mir immer 255,255,255 an. das ist die farbe für SetBkColor(RGB(255,255,255)) in der 'DrawTransparent(...)' -funktion.</p>
<p>also hat er das bitmap nicht gemalt sondern nur das feld für die angegeben maße; oder <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=":confused:"
      alt="😕"
    /><br />
ich habe das bild schon auf meinem normalen dialogfeld gemalt und es hat geklappt.</p>
<p>kann mir jemand helfen ??<br />
mfg RedSkall</p>
]]></description><link>https://www.c-plusplus.net/forum/post/417513</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/417513</guid><dc:creator><![CDATA[Red Skall]]></dc:creator><pubDate>Tue, 16 Dec 2003 14:19:05 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MemoryDC on Wed, 17 Dec 2003 04:41:11 GMT]]></title><description><![CDATA[<p>Da das problem in DrawTransparent liegt, wärs womöglich ganz net wenn du uns dem code der funktion zeigst, nicht das ausen rum <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="🙂"
    /><br />
(und die bitamp ist auf pixel 0,0 auch wirklich nicht wieß ? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /> )</p>
]]></description><link>https://www.c-plusplus.net/forum/post/417977</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/417977</guid><dc:creator><![CDATA[CMatt]]></dc:creator><pubDate>Wed, 17 Dec 2003 04:41:11 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MemoryDC on Wed, 17 Dec 2003 14:28:23 GMT]]></title><description><![CDATA[<p>ne, die funktion funktioniert ja, habe ich ja getestet, aber ok:</p>
<pre><code>void CMeinProgramm::DrawTransparent(CDC * pDC, HBITMAP hBmp, int x, int y, int iWidth, int iHight)
{  
	COLORREF crOldBack = pDC-&gt;SetBkColor(RGB(255, 255, 255)); 
	COLORREF crOldText = pDC-&gt;SetTextColor(RGB(0, 0, 0)); 
	CBitmap bBitmap; 
	CDC dcImage, dcTrans; 

	// Attach bitmap 
	bBitmap.Attach(hBmp); 

	// Create two memory dcs for the image and the mask 
	dcImage.CreateCompatibleDC(pDC); 
	dcTrans.CreateCompatibleDC(pDC); 

	// Select the image into the appropriate dc 
	CBitmap* pOldBitmapImage = dcImage.SelectObject(&amp;bBitmap); 

	// Create the mask bitmap 
	CBitmap bitmapTrans;
	bitmapTrans.CreateBitmap(iWidth, iHight, 1, 1, NULL); 

	// Select the mask bitmap into the appropriate dc 
	CBitmap* pOldBitmapTrans = dcTrans.SelectObject(&amp;bitmapTrans); 

	// Build mask based on transparent colour 
	dcImage.SetBkColor(crTransparent); 
	dcTrans.BitBlt(0, 0, iWidth, iHight, &amp;dcImage, 0, 0, SRCCOPY); 

	// Do the work - True Mask method - cool if not actual display 
	pDC-&gt;BitBlt(x, y, iWidth, iHight, &amp;dcImage, 0, 0, SRCINVERT); 
	pDC-&gt;BitBlt(x, y, iWidth, iHight, &amp;dcTrans, 0, 0, SRCAND);
	pDC-&gt;BitBlt(x, y, iWidth, iHight, &amp;dcImage, 0, 0, SRCINVERT); 

	// Restore settings 
	dcImage.SelectObject(pOldBitmapImage); 
	dcTrans.SelectObject(pOldBitmapTrans); 
	bBitmap.Detach(); 
	pDC-&gt;SetBkColor(crOldBack); 
	pDC-&gt;SetTextColor(crOldText); 
}
</code></pre>
<p>die pixel sind auch bestimmt nicht weiß <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/418365</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/418365</guid><dc:creator><![CDATA[Red Skall]]></dc:creator><pubDate>Wed, 17 Dec 2003 14:28:23 GMT</pubDate></item><item><title><![CDATA[Reply to Problem mit MemoryDC on Thu, 25 Dec 2003 11:49:45 GMT]]></title><description><![CDATA[<p>hey das ist wichtig, weiß keiner ne lösung ??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/422864</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/422864</guid><dc:creator><![CDATA[Red Skall]]></dc:creator><pubDate>Thu, 25 Dec 2003 11:49:45 GMT</pubDate></item></channel></rss>