![]() |
Unable to get the HANDLE of Menu |
Post Reply
|
| Author | |
KumarCJ
Groupie
Joined: 02 April 2007 Location: India Status: Offline Points: 96 |
Post Options
Thanks(0)
Quote Reply
Topic: Unable to get the HANDLE of MenuPosted: 04 April 2007 at 6:52am |
|
Hi, I have used the follwing code for Menu. -------------------------------------------- CXTPCommandBar* pMenuBarCmdBar = pCommandBars->SetMenu(_T ("Menu Bar"), IDR_MAINFRAME); if(pMenuBarCmdBar == NULL)
{ TRACE0("Failed to create menu bar.\n"); return -1; // fail to create } HMENU hMenu = GetMenu()->GetSafeHmenu();
//Problem: [Unable to get the HANDLE of Menu]
}//End of CMainFrame::OnCreate() Trying to get HANDLE of Menu in "OnCreate" using following code,
HMENU hMenu = GetMenu()->GetSafeHmenu(); But I am unable to get HANDLE. What is the way to get HANDLE of Menu???? Thanks, |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 05 April 2007 at 2:01am |
|
Hi,
CommandBars don't hold HMENU.
To modify Menu/Toolbars use CXTPControls methods.
f.e
pMenuBar->GetControls()->Add(..)
|
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
KumarCJ
Groupie
Joined: 02 April 2007 Location: India Status: Offline Points: 96 |
Post Options
Thanks(0)
Quote Reply
Posted: 05 April 2007 at 5:57am |
|
Hi, Thanks for reply. I do not want to add or modify the Menu. I need to assign Menu Handle to diffrent shared document template such as Spliter Window, BookView etc... Below code is defind in XYZ.h, for diffrent shared document template CSharedDocTemplate* m_pSplitWindowTempl; // Split Window The below given code is in OnCreate() of MainFrame.cpp, where we are assigning the Menu handle to diffrent shared document template. int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) CXTPMenuBar* pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME); HMENU hMenu = GetMenu()->GetSafeHmenu(); [As you told, since CommandBar dose not hold HMENU, We are not getting hMenu] CXYZApp * pApp = (CXYZApp *)AfxGetApp(); [But we need to assign handle of menu for diffrent shared document template.] pApp->m_pSplitWindowTempl->m_hMenuShared = hMenu; } Since we are not getting "hMenu", we are unable to assign it to diffrent shared document template. How we can assign handle of menu to diffrent shared document template. Thanks, KumarCJ |
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |