<?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 : Getting CMenu from CXTPControlPopup  I get error</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : Getting CMenu from CXTPControlPopup  I get error]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Wed, 13 May 2026 16:54:07 +0000</pubDate>
  <lastBuildDate>Wed, 24 Sep 2014 06:01:55 +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=22419</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[Getting CMenu from CXTPControlPopup  I get error :   olebed wrote: CXTPPopupBar...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=22419&amp;PID=72787&amp;title=getting-cmenu-from-cxtpcontrolpopup-i-get-error#72787</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=4319">sdancer75</a><br /><strong>Subject:</strong> 22419<br /><strong>Posted:</strong> 24 September 2014 at 6:01am<br /><br /><table width="99%"><tr><td class="BBquote"><img src="forum_images/quote_box.png" title="Originally posted by olebed" alt="Originally posted by olebed" style="vertical-align: text-bottom;" /> <strong>olebed wrote:</strong><br /><br /><table width="99%"><tr><td><pre class="BBcode">CXTPPopupBar *pChildBar = (CXTPPopupBar*)pCustomPopup-&gt;GetCommandBar();&nbsp;<br>CMenu *mm = pChildBar-&gt;GetMenu();  // &lt;-- At this point I get assertion error</pre></td></tr></table><br>but pChildBar-&gt;m_hWnd  is NULL  that is why assertion fired<br><table width="99%"><tr><td><pre class="BBcode">CMenu* CWnd::GetMenu() const<br>{<br>	ASSERT(::IsWindow(m_hWnd));<br>	return CMenu::FromHandle(::GetMenu(m_hWnd));<br>}</pre></td></tr></table><br>pPopupBar-&gt;LoadMenu(mmenu.GetSubMenu(0))  converts menu items to command bar controls. That is why you can't get CMenu which was loaded.<br>But you can use <br><table width="99%"><tr><td><pre class="BBcode">pChildBar-&gt;GetControls()-&gt;Add();<br>pChildBar-&gt;GetControls()-&gt;InsertAt();<br>pChildBar-&gt;GetControls()-&gt;AddMenuItem();<br>pChildBar-&gt;GetControls()-&gt;AddClone();<br><br>pChildBar-&gt;GetControls()-&gt;MoveBefore();<br></pre></td></tr></table><br>Fro example:<br><table width="99%"><tr><td><pre class="BBcode">CXTPPopupBar *pChildBar = (CXTPPopupBar*)pCustomPopup-&gt;GetCommandBar();&nbsp;<br>CXTPControl* pMenuItem = pChildBar-&gt;GetControls()-&gt;Add(xtpControlButton, ID_DYNAMIC_POPUP2 + 1);<br>pMenuItem-&gt;SetCaption(_T("Text 1"));</pre></td></tr></table><br></td></tr></table><div><br></div><div>Hi,</div><div><br></div><div>Thank you for your quick response. I was suspicious with the LoadMenu() thing.</div><div><br></div><div>In fact, I thought that the&nbsp;pPopupBar-&gt;LoadMenu(xxx) may have suppressed the CMenu structure in some way since the way you showed me to solve the problem, was already tested and verified that it works just fine.....<br><br>I should check the source code before I ask... but you help was precious and saved my time !</div><div><br></div><div>Best Regards,</div>]]>
   </description>
   <pubDate>Wed, 24 Sep 2014 06:01:55 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=22419&amp;PID=72787&amp;title=getting-cmenu-from-cxtpcontrolpopup-i-get-error#72787</guid>
  </item> 
  <item>
   <title><![CDATA[Getting CMenu from CXTPControlPopup  I get error :  CXTPPopupBar *pChildBar = (C...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=22419&amp;PID=72786&amp;title=getting-cmenu-from-cxtpcontrolpopup-i-get-error#72786</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=8730">olebed</a><br /><strong>Subject:</strong> 22419<br /><strong>Posted:</strong> 24 September 2014 at 5:35am<br /><br /><table width="99%"><tr><td><pre class="BBcode">CXTPPopupBar *pChildBar = (CXTPPopupBar*)pCustomPopup-&gt;GetCommandBar();&nbsp;<br>CMenu *mm = pChildBar-&gt;GetMenu();  // &lt;-- At this point I get assertion error</pre></td></tr></table><br>but pChildBar-&gt;m_hWnd  is NULL  that is why assertion fired<br><table width="99%"><tr><td><pre class="BBcode">CMenu* CWnd::GetMenu() const<br>{<br>	ASSERT(::IsWindow(m_hWnd));<br>	return CMenu::FromHandle(::GetMenu(m_hWnd));<br>}</pre></td></tr></table><br>pPopupBar-&gt;LoadMenu(mmenu.GetSubMenu(0))  converts menu items to command bar controls. That is why you can't get CMenu which was loaded.<br>But you can use <br><table width="99%"><tr><td><pre class="BBcode">pChildBar-&gt;GetControls()-&gt;Add();<br>pChildBar-&gt;GetControls()-&gt;InsertAt();<br>pChildBar-&gt;GetControls()-&gt;AddMenuItem();<br>pChildBar-&gt;GetControls()-&gt;AddClone();<br><br>pChildBar-&gt;GetControls()-&gt;MoveBefore();<br></pre></td></tr></table><br>Fro example:<br><table width="99%"><tr><td><pre class="BBcode">CXTPPopupBar *pChildBar = (CXTPPopupBar*)pCustomPopup-&gt;GetCommandBar();&nbsp;<br>CXTPControl* pMenuItem = pChildBar-&gt;GetControls()-&gt;Add(xtpControlButton, ID_DYNAMIC_POPUP2 + 1);<br>pMenuItem-&gt;SetCaption(_T("Text 1"));</pre></td></tr></table><br>]]>
   </description>
   <pubDate>Wed, 24 Sep 2014 05:35:49 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=22419&amp;PID=72786&amp;title=getting-cmenu-from-cxtpcontrolpopup-i-get-error#72786</guid>
  </item> 
  <item>
   <title><![CDATA[Getting CMenu from CXTPControlPopup  I get error : Thanks for the reply.I can verify...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=22419&amp;PID=72785&amp;title=getting-cmenu-from-cxtpcontrolpopup-i-get-error#72785</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=4319">sdancer75</a><br /><strong>Subject:</strong> 22419<br /><strong>Posted:</strong> 24 September 2014 at 3:49am<br /><br />Thanks for the reply.<div><br></div><div>I can verify that&nbsp;pChildBar is not null. I attach the original sample "Ribbon Controls" where I added my offended custom code at line number 524 inside the MainFrm.cpp.</div><div><br></div><div>Thanks</div><div><br></div><div><br></div><div><a href="uploads/4319/Ribb&#111;nC&#111;ntrols.zip" target="_blank" rel="nofollow">uploads/4319/RibbonControls.zip</a></div>]]>
   </description>
   <pubDate>Wed, 24 Sep 2014 03:49:55 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=22419&amp;PID=72785&amp;title=getting-cmenu-from-cxtpcontrolpopup-i-get-error#72785</guid>
  </item> 
  <item>
   <title><![CDATA[Getting CMenu from CXTPControlPopup  I get error : Hi,Can you please provide a small...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=22419&amp;PID=72784&amp;title=getting-cmenu-from-cxtpcontrolpopup-i-get-error#72784</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=8730">olebed</a><br /><strong>Subject:</strong> 22419<br /><strong>Posted:</strong> 23 September 2014 at 12:49pm<br /><br />Hi,<br><br>Can you please provide a small sample application so that we could debug this issue?&nbsp;<br><br>Make sure that pChildBar is not NULL and also really belongs to CXTPPopupBar class.<br><br>Thank you.<br>Regards, <br>&nbsp; &nbsp;Oleksandr Lebed<br>]]>
   </description>
   <pubDate>Tue, 23 Sep 2014 12:49:32 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=22419&amp;PID=72784&amp;title=getting-cmenu-from-cxtpcontrolpopup-i-get-error#72784</guid>
  </item> 
  <item>
   <title><![CDATA[Getting CMenu from CXTPControlPopup  I get error : Hi,I want to change (insert or...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=22419&amp;PID=72783&amp;title=getting-cmenu-from-cxtpcontrolpopup-i-get-error#72783</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=4319">sdancer75</a><br /><strong>Subject:</strong> 22419<br /><strong>Posted:</strong> 23 September 2014 at 8:31am<br /><br />Hi,<div><br></div><div>I want to change (insert or delete item) the popup menu of a&nbsp;CXTPControlPopup dynamically. I use the following code below, but everytime I am trying to get access to the popup menu I assertion error. Any Ideas ?</div><div><font size="1" color="#0000cc"><br></font></div><div><div><font size="1" color="#0000cc"><span ="Apple-tab-span" style="white-space:pre">		</span>m_pPopupHistory = (CXTPControlPopup*)pGroup0-&gt;Add(xtpControlButtonPopup, ID_POPUP_HISTORY);&nbsp;</font></div><div><font size="1" color="#0000cc"><span ="Apple-tab-span" style="white-space:pre">		</span>pPopupBar = CXTPPopupBar::CreatePopupBar(GetCommandBars());</font></div><div><font size="1" color="#0000cc"><span ="Apple-tab-span" style="white-space:pre">		</span>m_pPopupHistory-&gt;SetCommandBar(pPopupBar);</font><span style="color: rgb0, 0, 204; font-size: x-small; white-space: pre; line-height: 1.4;">		</span></div><div><font size="1" color="#0000cc"><span ="Apple-tab-span" style="white-space:pre">		</span>m_PopupHistoryMenu.LoadMenu(IDR_MENU_HISTORY);</font></div><div><font size="1" color="#0000cc"><span ="Apple-tab-span" style="white-space:pre">		</span>pPopupBar-&gt;LoadMenu(m_PopupHistoryMenu.GetSubMenu(0));<span ="Apple-tab-span" style="white-space:pre">		</span></font></div><div><font size="1" color="#0000cc"><span ="Apple-tab-span" style="white-space:pre">		</span>pPopupBar-&gt;InternalRelease();</font></div><div><font size="1" color="#0000cc"><br></font></div><div><font size="1" color="#0000cc"><span ="Apple-tab-span" style="white-space:pre">		</span>...........................................................&nbsp;</font></div><div><font size="1"><span ="Apple-tab-span" style="color: rgb0, 0, 204; white-space: pre;">		</span><font color="#006600">//somewhere in my code</font></font></div><div><span ="Apple-tab-span" style="white-space:pre"><font size="1" color="#0000cc">		</font></span></div><div><font size="1" color="#0000cc"><span ="Apple-tab-span" style="white-space:pre">		</span>CXTPPopupBar *pChildBar = (CXTPPopupBar*)m_pPopupHistory-&gt;GetCommandBar();<span ="Apple-tab-span" style="line-height: 1.4; white-space: pre;">	</span></font></div><div><font size="1" color="#0000cc"><span ="Apple-tab-span" style="white-space:pre">		</span>CMenu *mm = pChildBar-&gt;GetMenu(); &nbsp;// </font><font size="1" color="#ff0000">&lt;-- At this point I get assertion error</font></div><div><font size="1" color="#0000cc"><span ="Apple-tab-span" style="white-space:pre">		</span>mm-&gt;AppendMenu(MF_STRING, 1, "Text 1");<span ="Apple-tab-span" style="line-height: 1.4; white-space: pre;">		</span></font></div><div><font size="1" color="#0000cc"><span ="Apple-tab-span" style="white-space: pre;">		</span><span style="line-height: 16.7999992370605px;">pChildBar</span>-&gt;InternalRelease();</font></div></div>]]>
   </description>
   <pubDate>Tue, 23 Sep 2014 08:31:13 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=22419&amp;PID=72783&amp;title=getting-cmenu-from-cxtpcontrolpopup-i-get-error#72783</guid>
  </item> 
 </channel>
</rss>