<?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 : Get HICON from XTPImageManager</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : Get HICON from XTPImageManager]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Tue, 21 Apr 2026 02:52:57 +0000</pubDate>
  <lastBuildDate>Fri, 01 Oct 2010 02:18:25 +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=16605</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[Get HICON from XTPImageManager :  Hi Oleg,Have one more trouble...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=60615&amp;title=get-hicon-from-xtpimagemanager#60615</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=233">jimmy</a><br /><strong>Subject:</strong> 16605<br /><strong>Posted:</strong> 01 October 2010 at 2:18am<br /><br />Hi Oleg,<br><br>Have one more trouble with this.<br>CopyHandle does not create a HICON, if the ImageIcon is a alpha bitmap.<br><br>Now we use this.<br><pre>static HICON CreateAlphaIcon(HBITMAP hBitmap, DWORD dwWidth,DWORD dwHeight){// dwWidth &amp; Height could be extract from HBITMAP<br><br>	// Create an empty mask bitmap.	HBITMAP hMonoBitmap = CreateBitmap(dwWidth, dwHeight, 1, 1, NULL);	// Fill icon info.	ICONINFO ii;	ii.fIcon = TRUE;	ii.xHotspot = 0;	ii.yHotspot = 0;	ii.hbmMask = hMonoBitmap;	ii.hbmColor = hBitmap;	// Create the alpha icon with the alpha DIB section.	HICON hAlphaIcon = CreateIconIndirect(&amp;ii);	// Delete mask bitmap.	DeleteObject(hMonoBitmap);	return hAlphaIcon;}class CXTPImageManagerIconHandleEx : public CXTPImageManagerIconHandle{public:	HICON CreateIcon()	{		//		if (m_hIcon == NULL)		{			// Temporären Handle (Kopie) erzeugen.			CXTPImageManagerIconHandleEx temp;			temp.CopyHandle(*this);			// Wurde die Bitmap bereits in ein Icon konvertiert?			if (temp.GetIcon() != NULL)				// Das HICON extrahieren und setzen.				m_hIcon = temp.Detach();			// Gibt es nur ein Bitmap, dann handelt es sich um  ein Bitmap mit AlphaChannel.			else if (temp.GetBitmap() != NULL)				// Konvertieren des Alpha Bitmaps in ein Icon und setzen des Handle.				m_hIcon = CreateAlphaIcon(temp.GetBitmap(), temp.GetExtent().cx, temp.GetExtent().cy);			else				_ASSERTE(FALSE &amp;&amp; _T("Bitmap couldn't be converted into Icon"));		}		return m_hIcon;	} <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HICON Detach()	{		HICON hIcon = m_hIcon;		m_hIcon = NULL;		return hIcon;	}};<br><br>Please can you add also the code to create a HICON from alpha bitmap.<br><br>Thanks<br>&nbsp; Jimmy<br><br></pre><br>]]>
   </description>
   <pubDate>Fri, 01 Oct 2010 02:18:25 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=60615&amp;title=get-hicon-from-xtpimagemanager#60615</guid>
  </item> 
  <item>
   <title><![CDATA[Get HICON from XTPImageManager : Great, Thanks Oleg. Jimmy  ]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=60528&amp;title=get-hicon-from-xtpimagemanager#60528</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=233">jimmy</a><br /><strong>Subject:</strong> 16605<br /><strong>Posted:</strong> 28 September 2010 at 3:30am<br /><br />Great, <br><br>Thanks Oleg.<br><br>&nbsp;&nbsp; Jimmy<br>]]>
   </description>
   <pubDate>Tue, 28 Sep 2010 03:30:33 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=60528&amp;title=get-hicon-from-xtpimagemanager#60528</guid>
  </item> 
  <item>
   <title><![CDATA[Get HICON from XTPImageManager : Hi,Added. ]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=60518&amp;title=get-hicon-from-xtpimagemanager#60518</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 16605<br /><strong>Posted:</strong> 28 September 2010 at 12:58am<br /><br />Hi,<div><br></div><div>Added.</div>]]>
   </description>
   <pubDate>Tue, 28 Sep 2010 00:58:32 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=60518&amp;title=get-hicon-from-xtpimagemanager#60518</guid>
  </item> 
  <item>
   <title><![CDATA[Get HICON from XTPImageManager : Hello Oleg,Thanks for answer,...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=60509&amp;title=get-hicon-from-xtpimagemanager#60509</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=233">jimmy</a><br /><strong>Subject:</strong> 16605<br /><strong>Posted:</strong> 27 September 2010 at 11:02am<br /><br />Hello Oleg,<br><br>Thanks for answer, that work great.<br>i've a little wish.<br>please add<br>&nbsp;&nbsp;&nbsp; HICON Detach()<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; HICON hIcon = m_hIcon;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; m_hIcon = NULL;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return hIcon;<br>&nbsp;&nbsp;&nbsp; }<br>to CXTPImageManagerIconHandle class.<br><br>Thanks<br>&nbsp; Jimmy<br><br>]]>
   </description>
   <pubDate>Mon, 27 Sep 2010 11:02:23 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=60509&amp;title=get-hicon-from-xtpimagemanager#60509</guid>
  </item> 
  <item>
   <title><![CDATA[Get HICON from XTPImageManager : Hi,Yes, now all icons locates...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=60497&amp;title=get-hicon-from-xtpimagemanager#60497</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 16605<br /><strong>Posted:</strong> 27 September 2010 at 7:30am<br /><br />Hi,<div><br></div><div>Yes, now all icons locates in single GDI object.</div><div><br></div><div>Please copy it first when you need single icon:</div><div><br></div><div><div><span ="Apple-tab-span" style="white-space:pre">	</span>CXTPImageManagerIcon* pIcon = pCommandBars-&gt;GetImageManager()-&gt;GetImage(ID_COLOR_FORE);</div><div><br></div><div><span ="Apple-tab-span" style="white-space:pre">	</span>CXTPImageManagerIconHandle handle;</div><div><span ="Apple-tab-span" style="white-space:pre">	</span>handle.CopyHandle(pIcon-&gt;GetIcon());</div><div><span ="Apple-tab-span" style="white-space:pre">	</span>HICON hIcon1 = handle;</div></div>]]>
   </description>
   <pubDate>Mon, 27 Sep 2010 07:30:15 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=60497&amp;title=get-hicon-from-xtpimagemanager#60497</guid>
  </item> 
  <item>
   <title><![CDATA[Get HICON from XTPImageManager : Hello,Any solution for this ?We...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=60319&amp;title=get-hicon-from-xtpimagemanager#60319</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=233">jimmy</a><br /><strong>Subject:</strong> 16605<br /><strong>Posted:</strong> 20 September 2010 at 9:08am<br /><br />Hello,<br><br>Any solution for this ?<br>We add all your bmp, ico, Toolbar icons, ... to the ImageManager.<br>But how can i get a HICON from the ImageManager ?<br>I'll add the Icon to a dialog.<br><br>&nbsp; Jimmy<br><br>]]>
   </description>
   <pubDate>Mon, 20 Sep 2010 09:08:34 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=60319&amp;title=get-hicon-from-xtpimagemanager#60319</guid>
  </item> 
  <item>
   <title><![CDATA[Get HICON from XTPImageManager : Hello,Thanks for answer.But this...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=58173&amp;title=get-hicon-from-xtpimagemanager#58173</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=233">jimmy</a><br /><strong>Subject:</strong> 16605<br /><strong>Posted:</strong> 23 April 2010 at 8:10am<br /><br />Hello,<br><br>Thanks for answer.<br>But this doesn't help.<br>My old function use this for fill a own CImageList (with ID's) with<br>using ImageManager to Load from toolbar (with id's).<br>Now i have add my own function loading toolbar id's.<br><br>But i think, it's not correct from CJ to return no ICON.<br>CJ can remove this function an can add a new function.<br>CXTPImageManagerIcon* pIcon = pCommandBars-&gt;GetImageManager()-&gt;GetImage(ID_COLOR_FORE);<br>HICON hIcon1 = pIcon-&gt;<b>CreateIcon</b>();<br><br>&nbsp; Jimmy<br><br>]]>
   </description>
   <pubDate>Fri, 23 Apr 2010 08:10:03 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=58173&amp;title=get-hicon-from-xtpimagemanager#58173</guid>
  </item> 
  <item>
   <title><![CDATA[Get HICON from XTPImageManager : Later versions store icons as...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=58172&amp;title=get-hicon-from-xtpimagemanager#58172</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2198">znakeeye</a><br /><strong>Subject:</strong> 16605<br /><strong>Posted:</strong> 23 April 2010 at 6:11am<br /><br /><DIV>Later versions store icons as one single image to decrease GDI resource usage. Try something like this:</DIV><DIV>&nbsp;</DIV><DIV>BOOL IconFromPNG(HINSTANCE hInstance, UINT nResourceID, CXTPImageManagerIconHandle &amp;hIconHandle)<BR>{<BR>&nbsp;&nbsp;&nbsp; hIconHandle.Clear();</DIV><P>&nbsp;&nbsp;&nbsp; BOOL bAlphaBitmap = FALSE;<BR>&nbsp;&nbsp;&nbsp; HBITMAP hBitmap = CXTPImageManagerIcon::LoadBitmapFromResource(hInstance, MAKEINTRESOURCE(nResourceID), &amp;bAlphaBitmap);<BR>&nbsp;&nbsp;&nbsp; if (hBitmap)<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (bAlphaBitmap)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hIconHandle = hBitmap; // Will call DeleteObject;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CBitmap bmpIcon;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bmpIcon.Attach(hBitmap);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Convert the bitmap to a transparent icon.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; HICON hIcon = CXTPTransparentBitmap(bmpIcon).ConvertToIcon();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hIconHandle = hIcon; // Will call DestoyIcon.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp; return !hIconHandle.IsEmpty();<BR>}</P><DIV></DIV>]]>
   </description>
   <pubDate>Fri, 23 Apr 2010 06:11:38 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=58172&amp;title=get-hicon-from-xtpimagemanager#58172</guid>
  </item> 
  <item>
   <title><![CDATA[Get HICON from XTPImageManager : Hello,have some trouble after...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=58115&amp;title=get-hicon-from-xtpimagemanager#58115</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=233">jimmy</a><br /><strong>Subject:</strong> 16605<br /><strong>Posted:</strong> 16 April 2010 at 7:01am<br /><br />Hello,<br><br>have some trouble after change from V11.1.3 to V14.0.0Beta.<br><br>i add a Toolbar to XTPImageManager.<br>than i will get a HICON, but it return NULL.<br><br>add this lines <br> CXTPImageManagerIcon* pIcon = pCommandBars-&gt;GetImageManager()-&gt;GetImage(ID_COLOR_FORE);<br>HICON hIcon1 = pIcon-&gt;GetIcon();<br><br>after<br>line: &nbsp;&nbsp;&nbsp; pCommandBars-&gt;GetImageManager()-&gt;SetIcons(IDR_TOOLBAR_COLOR);<br>in CommandBarControls Sample (MainFrm.cpp).<br><br>&nbsp; hIcon1 is NULL.<br><br>Any solution to retrieve HICON ?<br><br>Thanks<br>&nbsp;&nbsp; Jimmy<br><br><br><br>]]>
   </description>
   <pubDate>Fri, 16 Apr 2010 07:01:32 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=16605&amp;PID=58115&amp;title=get-hicon-from-xtpimagemanager#58115</guid>
  </item> 
 </channel>
</rss>