Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

Please kindly Help in this creation of cascading of Menus.

As a first step. i made the first level of code like this way . but i am getting crash please kindly help me. My code is Mentioned here.

I have two Cpp File Example File1 and File 2

in File 1

C++
void CFile1::OnContextMenu(CWnd* pWnd, CPoint point) 
{
  

  CMenu menuPopup;
  menuPopup.LoadMenu(IDR_CNTXT_PLAN);
  CFile2* pView = (CFile2*)GetActiveView();

  pView->UpdateMenu(&menuPopup);

 menuPopup.GetSubMenu(0)->TrackPopupMenu(TPM_LEFTALIGN, point.x, point.y, this);

}

In File2
C++
void CFile2::UpdateMenu(CMenu* pMenu)
{
  CMenu subMenu;
  subMenu.CreatePopupMenu();
  subMenu.AppendMenu(MF_STRING,UDP_Vis_Layer,"VIS");
  
  CMenu* pLayerMenu = pMenu->GetSubMenu(0);
  pLayerMenu->InsertMenu(0,MF_BYPOSITION|MF_POPUP,(UINT)subMenu.m_hMenu,"Layers");
  pMenu->GetSubMenu(0)->InsertMenu(1,MF_BYPOSITION|MF_SEPARATOR,0,"");

}

please kindly help me
Posted
Updated 21-Dec-14 23:15pm
v2
Comments
Richard MacCutchan 22-Dec-14 5:16am    
What is the layout of your menu resources? Please update your question with the script content.
Richard MacCutchan 22-Dec-14 5:16am    
Note, I have deleted your duplicate of this question.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900