<?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 : Help with dynamic menu items</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : Help with dynamic menu items]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Tue, 21 Apr 2026 12:55:26 +0000</pubDate>
  <lastBuildDate>Thu, 20 Feb 2025 08:13:29 +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=24552</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[Help with dynamic menu items : Hi there,I&amp;#039;m trying to manage...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=24552&amp;PID=79149&amp;title=help-with-dynamic-menu-items#79149</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=9487">thomasmfields</a><br /><strong>Subject:</strong> 24552<br /><strong>Posted:</strong> 20 February 2025 at 8:13am<br /><br /><div>Hi there,</div><div><br></div><div>I'm trying to manage my own recent files list as part of my File drop down menu.</div><div><br></div><div>In my .rc file I have:</div><div><br></div><div>IDR_MAINFRAME MENU</div><div>BEGIN</div><div>&nbsp; &nbsp; POPUP "&amp;File"</div><div>&nbsp; &nbsp; BEGIN</div><div>&nbsp; &nbsp; &nbsp; &nbsp; MENUITEM "&amp;New",&nbsp; &nbsp; &nbsp;ID_FILE_NEW</div><div>&nbsp; &nbsp; &nbsp; &nbsp; MENUITEM "&amp;Open", ID_FILE_OPEN</div><div>&nbsp; &nbsp; &nbsp; &nbsp; MENUITEM "Recent File",&nbsp; &nbsp; &nbsp; ID_RECENT_FILE</div><div>&nbsp; &nbsp; &nbsp; &nbsp; MENUITEM "&amp;Exit",&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ID_FILE_EXIT</div><div>&nbsp; &nbsp; END</div><div>END</div><div><br></div><div>Then in my callback for ID_RECENT_FILE I have:</div><div><br></div><div>CXTPCommandBar* menuBar = MainFrame::GetInstance()-&gt;m_menuBar;</div><div>if (menuBar)</div><div>{</div><div><span style="white-space: normal;"><span style="white-space:pre">		</span>CXTPControls* pControls = menuBar-&gt;GetControls();</span></div><div><span style="white-space: normal;"><span style="white-space:pre">		</span>CXTPControl* pControl = pControls-&gt;GetAt(0);<span style="white-space:pre">	</span>// File menu is 0</span></div><div><span style="white-space: normal;"><span style="white-space:pre">		</span>CXTPControls* pUtilCtrls = pControl-&gt;GetCommandBar()-&gt;GetControls();</span></div><div><span style="white-space: normal;"><span style="white-space:pre">		</span>CXTPControl* pSubMenuItemCtrl = pUtilCtrls-&gt;GetAt(2);<span style="white-space:pre">	</span>// New (0), Open (1), Recent File (2)</span></div><div><span style="white-space: pre; white-space: normal;">		</span></div><div><span style="white-space: normal;"><span style="white-space:pre">		</span>CMenu *SubMenu = new CMenu;</span></div><div><span style="white-space: normal;"><span style="white-space:pre">		</span>SubMenu-&gt;CreatePopupMenu();</span></div><div><br></div><div><span style="white-space: normal;"><span style="white-space:pre">		</span>SubMenu-&gt;AppendMenu(MF_BYPOSITION | MF_STRING, kBaseEffectMenuOptionId2+1, _T("Item3-1"));</span></div><div><span style="white-space: normal;"><span style="white-space:pre">		</span>SubMenu-&gt;AppendMenu(MF_BYPOSITION | MF_STRING, kBaseEffectMenuOptionId2+2, _T("Item3-2"));</span></div><div><span style="white-space: normal;"><span style="white-space:pre">		</span>SubMenu-&gt;AppendMenu(MF_BYPOSITION | MF_STRING, kBaseEffectMenuOptionId2+3, _T("Item3-3"));</span></div><div><span style="white-space: pre; white-space: normal;">		</span></div><div><span style="white-space: normal;"><span style="white-space:pre">		</span>CMenu *SubSubMenu = new CMenu;</span></div><div><span style="white-space: normal;"><span style="white-space:pre">		</span>SubSubMenu-&gt;CreatePopupMenu();</span></div><div><span style="white-space: normal;"><span style="white-space:pre">		</span>SubSubMenu-&gt;InsertMenu(0, MF_BYPOSITION | MF_POPUP | MF_STRING, (UINT_PTR)SubMenu-&gt;m_hMenu, _T("Recent File"));</span></div><div><br></div><div><span style="white-space: normal;"><span style="white-space:pre">		</span>pUtilCtrls-&gt;AddMenuItem(SubSubMenu, 0);</span></div><div>}</div><div><br></div><div>The problem is that the AddMenuItem() seems to just put the new menu at the bottom of my File menu. So I get:</div><div><br></div><div>New</div><div>Open</div><div>Recent File</div><div>Exit</div><div>Recent File</div><div><br></div><div>How do I move it (and replace) the existing "Recent File" entry that appears 3rd in the list?</div><div><br></div><div>Many thanks</div>]]>
   </description>
   <pubDate>Thu, 20 Feb 2025 08:13:29 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=24552&amp;PID=79149&amp;title=help-with-dynamic-menu-items#79149</guid>
  </item> 
 </channel>
</rss>