Link to home
Start Free TrialLog in
Avatar of tariq6000
tariq6000

asked on

Context Menu

Hi Experts,

I am trying to create a context menu. But a exception is coming.

Context menu is :  File->Add
My code is

<code>
CMenu menu;
      menu.LoadMenu(IDR_CONTEXT);
      CMenu* pPopup = menu.GetSubMenu(0);
      CWnd* pWndPopupOwner = this;

      CMenu *mnuPopupMenu = pPopup-&gt;GetSubMenu(0);
      ASSERT(mnuPopupMenu);


      while(pWndPopupOwner-&gt;GetStyle() &amp; WS_CHILD)
            pWndPopupOwner = pWndPopupOwner-&gt;GetParent();
      pPopup-&gt;TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
            point.x,
            point.y,
            AfxGetMainWnd(), NULL);
</code>

What is wrong with this?
Avatar of AndyAinscow
AndyAinscow
Flag of Switzerland image

CMenu *mnuPopupMenu = pPopup-&gt;

That doesn't look correct.
ASKER CERTIFIED SOLUTION
Avatar of alb66
alb66
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Forced accept.

Computer101
EE Admin