<?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 : CXTPC&#111;ntrol SetCustomIc&#111;n and ic&#111;n copy</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : CXTPC&#111;ntrol SetCustomIc&#111;n and ic&#111;n copy]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Thu, 11 Jun 2026 18:43:44 +0000</pubDate>
  <lastBuildDate>Wed, 08 Feb 2006 14:09:17 +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=3532</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[CXTPC&#111;ntrol SetCustomIc&#111;n and ic&#111;n copy : Perfect. That was the key. Thank...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3532&amp;PID=10883&amp;title=cxtpcontrol-setcustomicon-and-icon-copy#10883</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1568">fishy</a><br /><strong>Subject:</strong> 3532<br /><strong>Posted:</strong> 08 February 2006 at 2:09pm<br /><br />Perfect.&nbsp; That was the key.&nbsp; Thank you very much Oleg!]]>
   </description>
   <pubDate>Wed, 08 Feb 2006 14:09:17 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3532&amp;PID=10883&amp;title=cxtpcontrol-setcustomicon-and-icon-copy#10883</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPC&#111;ntrol SetCustomIc&#111;n and ic&#111;n copy : ok, I see problem, right Icons...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3532&amp;PID=10654&amp;title=cxtpcontrol-setcustomicon-and-icon-copy#10654</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 3532<br /><strong>Posted:</strong> 24 January 2006 at 1:46pm<br /><br /><P>ok, I see problem, right Icons collected in array and destroyed in application exit.</P><P>you have right idea about destructor things, </P><P>but you can delete all controls when popup closed:</P><P>&nbsp;BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)<BR>&nbsp;&nbsp;&nbsp;&nbsp; //{{AFX_MSG_MAP(CMainFrame)<BR>&nbsp;&nbsp;&nbsp;&nbsp; ON_XTP_UNINITCOMMANDSPOPUP()<BR>&nbsp;&nbsp;&nbsp;&nbsp; //}}AFX_MSG_MAP<BR>&nbsp;END_MESSAGE_MAP()<BR>&nbsp;</P><P><BR>void CMainFrame::OnUninitCommandsPopup(CXTPPopupBar* pPopupBar)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp; // get the list of commands for the popup.<BR>&nbsp;&nbsp;&nbsp; CXTPControls* pControls = pPopupBar-&gt;GetControls();<BR>&nbsp;}<BR></P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Tue, 24 Jan 2006 13:46:28 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3532&amp;PID=10654&amp;title=cxtpcontrol-setcustomicon-and-icon-copy#10654</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPC&#111;ntrol SetCustomIc&#111;n and ic&#111;n copy : Any ideas here? I would like a...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3532&amp;PID=10645&amp;title=cxtpcontrol-setcustomicon-and-icon-copy#10645</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1568">fishy</a><br /><strong>Subject:</strong> 3532<br /><strong>Posted:</strong> 23 January 2006 at 9:41am<br /><br /><P>Any ideas here?&nbsp; I would like a good solution for this.</P><P>I have a temporary solution for this problem but there is still a small issue with my solution.&nbsp; My solution is to derive a class from the CXTPControlButton and remove the custom icon in its destructor.&nbsp; I have the following code in the destructor of the derived class:</P><P><FONT face="Courier New, Courier, mono" color=#000099>&nbsp;// Cleanup the custom icon if it exists<BR>&nbsp;CXTPImageManager* pImageManager = GetImageManager();<BR>&nbsp;if (pImageManager != NULL &amp;&amp; m_nCustomIconId != 0)<BR>&nbsp;{<BR>&nbsp;&nbsp;&nbsp; pImageManager-&gt;RemoveIcon(m_nCustomIconId);<BR>&nbsp;}</FONT></P><P>Now, when the menu is displayed the custom icons are assigned and copied (internally in CXTPImageManagerIcon::SetIcon).&nbsp; The next time the menu is clicked I remove all all the CXTPControlButtons in the menu (which deletes them and causes my destructor to be called, deleting the custom icons).&nbsp; However, this solution keeps the icons allocated between calls to OnCalcDynamicSize.&nbsp; If, for example, the user clicks the menu only once, then the icons won't be deleted until the window is closed.&nbsp; In fact, the icons created by the last click of the menu won't be deleted until the window is closed.&nbsp; (Because OnCalcDynamicSize isn't called again).&nbsp; So, is there a way to detect when the menu is closing so that I can delete the CXTPControlButtons there and not in the OnCalcDynamicSize call?&nbsp; I believe that would solve this issue.</P><P>..Waiting for a response..</P><P>- fishy</P><P>&nbsp;</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Mon, 23 Jan 2006 09:41:01 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3532&amp;PID=10645&amp;title=cxtpcontrol-setcustomicon-and-icon-copy#10645</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPC&#111;ntrol SetCustomIc&#111;n and ic&#111;n copy : Again, I think I am missing something...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3532&amp;PID=10604&amp;title=cxtpcontrol-setcustomicon-and-icon-copy#10604</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1568">fishy</a><br /><strong>Subject:</strong> 3532<br /><strong>Posted:</strong> 19 January 2006 at 9:11am<br /><br />Again, I think I am missing something here but look at the code forCXTPControl::SetCustomIcon(HICON hIcon).&nbsp; It callsAddCustomIcon(hIcon) on the CXTPImageManager (which copies the icon)and assigns the returned icon id to the m_nCustomIconId variable.&nbsp;Now, when the CXTPControl is deleted, the m_nCustomIconId is neverremoved from the ImageManager, and thus never cleared.<br><br>How would I go about deleting the icon that is allocated fromSetCustomIcon call in CXTPControl?&nbsp; Should I manually delete it bycalling clear on the ImageManager?&nbsp; <br><br>Let me give you my situation to help you understand the problem.&nbsp;I am trying to make a dynamic menu that is populated with the names andicons of all the currently running applications.&nbsp; I haveaccomplished this (minus the icons) by creating my ownCXTPControlButton in OnCreateControl.&nbsp; In the CXTPControlButton'sOnCalcDynamicSize I create a CXTPControlButton for each runningapplication.&nbsp; This works great.&nbsp; The problem is that when Iassign an icon to the CXTPControlButton, the icon is copied anddisplayed (this also works) but is never deleted.&nbsp; The next timethe menu is displayed the icon is copied again, and not deleted again,etc.. etc...&nbsp; leaking icon handles every time you click on themenu.&nbsp;&nbsp; I'm sure there is a way to do this correctly.&nbsp; <br><br>- fishy<br>]]>
   </description>
   <pubDate>Thu, 19 Jan 2006 09:11:52 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3532&amp;PID=10604&amp;title=cxtpcontrol-setcustomicon-and-icon-copy#10604</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPC&#111;ntrol SetCustomIc&#111;n and ic&#111;n copy : yes, it is copied. it will be...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3532&amp;PID=10599&amp;title=cxtpcontrol-setcustomicon-and-icon-copy#10599</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 3532<br /><strong>Posted:</strong> 19 January 2006 at 12:00am<br /><br /><P>yes, it is copied. it will be destroyed automatically in Clear method:</P><P>void CXTPImageManagerIconHandle::Clear()<BR>{<BR>&nbsp;if (m_bClearHandles)<BR>&nbsp;{<BR>&nbsp;&nbsp;if (m_hIcon)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;<strong>DestroyIcon</strong>(m_hIcon);<BR>&nbsp;&nbsp;}<BR>...</P><P>}<BR>&nbsp;</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Thu, 19 Jan 2006 00:00:57 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3532&amp;PID=10599&amp;title=cxtpcontrol-setcustomicon-and-icon-copy#10599</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPC&#111;ntrol SetCustomIc&#111;n and ic&#111;n copy : Hello, If i use CXTPControl::SetCustomIcon...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=3532&amp;PID=10596&amp;title=cxtpcontrol-setcustomicon-and-icon-copy#10596</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1568">fishy</a><br /><strong>Subject:</strong> 3532<br /><strong>Posted:</strong> 18 January 2006 at 5:11pm<br /><br />Hello,<br>If i use CXTPControl::SetCustomIcon (in place of SetIconId in anexample similar to DynamicPopups -- see CControlShell) it appears thatthe HICON is being copied (m_hIcon.CopyHandle(..) inCXTPImageManagerIcon::SetIcon(CXTPImageManagerIconHandle hIcon)<br>&nbsp;to be exact).&nbsp; However, I do not see how this copied handleis being destroyed.&nbsp; Whenever my submenu that uses SetCustomIconis displayed, the icons are copied and not deleted - resulting in ahandle leak.&nbsp; I am sure I am missing something here but what isthe correct way to use SetCustomIcon?<br><br>- fish<br>]]>
   </description>
   <pubDate>Wed, 18 Jan 2006 17:11:58 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=3532&amp;PID=10596&amp;title=cxtpcontrol-setcustomicon-and-icon-copy#10596</guid>
  </item> 
 </channel>
</rss>