<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Method AcPane::DisplayPopupPaneMenu() makes AutoCAD crash in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/method-acpane-displaypopuppanemenu-makes-autocad-crash/m-p/8903113#M5272</link>
    <description>&lt;P&gt;I am unable to recreate the crash at my end using the sample downloadable in the below link&lt;BR /&gt;&lt;A href="https://adndevblog.typepad.com/autocad/2015/04/positioning-acpane-in-statusbar.html" target="_blank" rel="noopener"&gt;https://adndevblog.typepad.com/autocad/2015/04/positioning-acpane-in-statusbar.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have made the following changes to the sample (ensure ARXDBG tool is loaded)&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1) Display the the&lt;STRONG&gt; ARXDBG_MNU_APP&lt;/STRONG&gt; of the ARXDBG tool :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;void CPaneItem::OnLButtonDown(UINT nFlags, CPoint point)
{
	CMenu menu;
	CAcModuleResourceOverride();
	if (menu.LoadMenu(ARXDBG_MNU_APP)) {
		DisplayPopupPaneMenu(menu);
	}
}
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2) Set the ACSB_POPUP style to the pane item&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Image after left button click on the pane item&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cMenu.JPG" style="width: 374px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/656438i82A6C1CACFA6C05C/image-dimensions/374x409?v=v2" width="374" height="409" role="button" title="cMenu.JPG" alt="cMenu.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 11 Jul 2019 08:55:21 GMT</pubDate>
    <dc:creator>deepak.a.s.nadig</dc:creator>
    <dc:date>2019-07-11T08:55:21Z</dc:date>
    <item>
      <title>Method AcPane::DisplayPopupPaneMenu() makes AutoCAD crash</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/method-acpane-displaypopuppanemenu-makes-autocad-crash/m-p/8898026#M5271</link>
      <description>&lt;P&gt;I have a class &lt;STRONG&gt;MyPane&lt;/STRONG&gt; deriver from &lt;STRONG&gt;AcPane&lt;/STRONG&gt;. During ARX startup I add it to AutoCAD status bar. My goal is to display popup menu when I left-click on &lt;STRONG&gt;MyPane&lt;/STRONG&gt;. There is an event&lt;/P&gt;&lt;DIV class="Element720"&gt;&lt;DIV class="Element721"&gt;&lt;DIV class="Element58"&gt;&lt;DIV&gt;&lt;DIV class="Element101"&gt;&lt;DIV class="Element100"&gt;&lt;PRE&gt;virtual void AcStatusBarItem::OnLButtonDown(UINT nFlags, CPoint point)&lt;/PRE&gt;&lt;DIV class="Element710"&gt;&lt;DIV class="Element92"&gt;&lt;DIV class="Element5"&gt;which allows me to do that.&lt;/DIV&gt;&lt;DIV class="Element5"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="Element5"&gt;Here is my code&lt;/DIV&gt;&lt;DIV class="Element5"&gt;&lt;PRE&gt;void MyPane::OnLButtonDown(UINT nFlags, CPoint point)
{
CAcModuleResourceOverride resOverride; // I tried to define menu globally to get rid of CAcModuleResourceOverride from here. no luck
CMenu menu;
CMenu.LoadMenu(MAKEINTRESOURCE(IDM_SOME_MENU));
// no need for result right now
DisplayPopupPaneMenu(menu);
}&lt;/PRE&gt;Last line makes AutoCAD crash with access violation error.&lt;/DIV&gt;&lt;DIV class="Element5"&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class="Element5"&gt;P.S. MyPane class has ACSB_POPUP style.&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 09 Jul 2019 11:06:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/method-acpane-displaypopuppanemenu-makes-autocad-crash/m-p/8898026#M5271</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-09T11:06:42Z</dc:date>
    </item>
    <item>
      <title>Re: Method AcPane::DisplayPopupPaneMenu() makes AutoCAD crash</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/method-acpane-displaypopuppanemenu-makes-autocad-crash/m-p/8903113#M5272</link>
      <description>&lt;P&gt;I am unable to recreate the crash at my end using the sample downloadable in the below link&lt;BR /&gt;&lt;A href="https://adndevblog.typepad.com/autocad/2015/04/positioning-acpane-in-statusbar.html" target="_blank" rel="noopener"&gt;https://adndevblog.typepad.com/autocad/2015/04/positioning-acpane-in-statusbar.html&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have made the following changes to the sample (ensure ARXDBG tool is loaded)&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;1) Display the the&lt;STRONG&gt; ARXDBG_MNU_APP&lt;/STRONG&gt; of the ARXDBG tool :&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;void CPaneItem::OnLButtonDown(UINT nFlags, CPoint point)
{
	CMenu menu;
	CAcModuleResourceOverride();
	if (menu.LoadMenu(ARXDBG_MNU_APP)) {
		DisplayPopupPaneMenu(menu);
	}
}
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 2) Set the ACSB_POPUP style to the pane item&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;Image after left button click on the pane item&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="cMenu.JPG" style="width: 374px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/656438i82A6C1CACFA6C05C/image-dimensions/374x409?v=v2" width="374" height="409" role="button" title="cMenu.JPG" alt="cMenu.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Jul 2019 08:55:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/method-acpane-displaypopuppanemenu-makes-autocad-crash/m-p/8903113#M5272</guid>
      <dc:creator>deepak.a.s.nadig</dc:creator>
      <dc:date>2019-07-11T08:55:21Z</dc:date>
    </item>
    <item>
      <title>Re: Method AcPane::DisplayPopupPaneMenu() makes AutoCAD crash</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/method-acpane-displaypopuppanemenu-makes-autocad-crash/m-p/8905399#M5273</link>
      <description>&lt;P&gt;Thank you for your reply. I have found the reason which caused the problem.&lt;/P&gt;&lt;P&gt;In 'rc' file my menu was declared like this:&lt;/P&gt;&lt;PRE&gt;IDM_SOME_MENU MENU 
BEGIN
    MENUITEM "Item 1",                 ID_MENU_ITEM1
    MENUITEM "Item 2",                 ID_MENU_ITEM2
    MENUITEM "Item 3",                 ID_MENU_ITEM3
END&lt;/PRE&gt;&lt;P&gt;But it should look like this:&lt;/P&gt;&lt;PRE&gt;IDM_SOME_MENU MENU 
BEGIN
    POPUP "Some Menu"
    BEGIN
        MENUITEM "Item 1",                 ID_MENU_ITEM1
        MENUITEM "Item 2",                 ID_MENU_ITEM2
        MENUITEM "Item 3",                 ID_MENU_ITEM3
    END
END&lt;/PRE&gt;&lt;P&gt;With this kind of popup menu I finally could get it work properly.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jul 2019 05:49:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/method-acpane-displaypopuppanemenu-makes-autocad-crash/m-p/8905399#M5273</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-07-12T05:49:43Z</dc:date>
    </item>
  </channel>
</rss>

