<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : Load PNG From resource with CodeJock</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : Load PNG From resource with CodeJock]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Wed, 22 Apr 2026 01:27:26 +0000</pubDate>
  <lastBuildDate>Mon, 20 Apr 2009 15:27:11 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=14081</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[Load PNG From resource with CodeJock : After we moved to V12 we had problems...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=14081&amp;PID=48168&amp;title=load-png-from-resource-with-codejock#48168</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3213">rdhd</a><br /><strong>Subject:</strong> 14081<br /><strong>Posted:</strong> 20 April 2009 at 3:27pm<br /><br />After we moved to V12 we had problems getting bitmaps. We had to create a CXTPImageManagerIconHandle and call CopyHandle. The input was the CXTPImageManagerIconHandle<FONT size=2> <P></FONT><FONT size=2><FONT size=2><FONT color=#000000>CXTPImageManagerIconHandle IconCopy;</FONT></P></FONT></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2><FONT color=#000000>IconCopy.CopyHandle(IconHandle);</P><DIV></DIV><P>We could then get the HBITMAP. However, with png files, the returned bitmap was rendered with a black background and I could not find a way to control that. So we then used the <FONT size=2>CXTPImageManagerIconHandle </FONT>and createded a compatible DC and drew into the DC. It went something like this:</P><DIV></DIV><DIV></DIV><FONT size=2><P>CDC *pDCSrc = GetDC();</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2>(pDCSrc)</P><P>{</P><P></FONT><FONT size=2>HDC hDCMem = CreateCompatibleDC( NULL );</P><P>HBITMAP hBmpOld = 0;</P><P>HBRUSH hBrush = CreateSolidBrush( Background );</P><P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// create a bitmap that will be used after the </P></FONT></FONT><FONT size=2><P></FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// icon is drawn</P></FONT></FONT><FONT size=2><P>hbm = CreateCompatibleBitmap( pDCSrc-&gt;m_hDC, nWidth, nWidth );</P><P>hBmpOld = (HBITMAP)SelectObject( hDCMem, hbm );</P><P>CPoint pt;</P><P>pt.x = pt.y = 0;</P><P>HBRUSH hBrushOld = (HBRUSH)SelectObject( hDCMem, hBrush );</P><P></P><P>HPEN hPenOld = (HPEN)SelectObject(hDCMem,GetStockObject(NULL_PEN));</P><P>Rectangle( hDCMem, 0, 0, nWidth+1, nWidth+1 );</P><P>CSize szIcon;</P><P>szIcon.cx = szIcon.cy = nWidth;</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>bool</FONT></FONT><FONT size=2> bDrawComposited = </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>false</FONT></FONT><FONT size=2>;</P><P>CDC* tmpDC;</P><P>tmpDC = CDC::FromHandle( hDCMem );</P><P>IconHandle.Draw( tmpDC, pt, szIcon, bDrawComposited );</P><P>SelectObject( hDCMem, hBrushOld );</P><P>SelectObject( hDCMem, hPenOld );</P><P>SelectObject( hDCMem, hBmpOld );</P><P>DeleteObject( hBrush );</P><P>DeleteDC( hDCMem );</P><P>DeleteDC( pDCSrc-&gt;m_hDC);</P></FONT></FONT></FONT></FONT>]]>
   </description>
   <pubDate>Mon, 20 Apr 2009 15:27:11 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=14081&amp;PID=48168&amp;title=load-png-from-resource-with-codejock#48168</guid>
  </item> 
  <item>
   <title><![CDATA[Load PNG From resource with CodeJock : Hi,which class can load a PNG...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=14081&amp;PID=48145&amp;title=load-png-from-resource-with-codejock#48145</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=4159">barobax</a><br /><strong>Subject:</strong> 14081<br /><strong>Posted:</strong> 20 April 2009 at 7:55am<br /><br />Hi,<br>which class can load a PNG file from dll resources and make HBITMAP for resource ?!?<br><br>I tried CXTPImageManager and CXTPImageIcon and CXTPImageIconHandle but I can't load my resource. I have HINSTANCE handle and when I try to load PNG file with handle The HBITMAP is NULL.<br><br>please help me,<br>Thanks,<br>Best Regards.<br>]]>
   </description>
   <pubDate>Mon, 20 Apr 2009 07:55:45 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=14081&amp;PID=48145&amp;title=load-png-from-resource-with-codejock#48145</guid>
  </item> 
 </channel>
</rss>