Print Page | Close Window

Not getting HMENU of MDI Menu

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: General Discussion
Forum Description: Topics Related to Visual C++ MFC Development in General
URL: http://forum.codejock.com/forum_posts.asp?TID=6589
Printed Date: 04 October 2024 at 6:44pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Not getting HMENU of MDI Menu
Posted By: Makarand
Subject: Not getting HMENU of MDI Menu
Date Posted: 08 March 2007 at 1:41am
Hello,
 
I have created MDI application with MDI menu by using following code
 
if (!InitCommandBars())
  return -1;
    
CXTPCommandBars* pCommandBars = GetCommandBars();
 if(pCommandBars == NULL)
 {
  TRACE0("Failed to create command bars object.\n");
  return -1;      // fail to create
 }
 // Add the menu bar
 CXTPMenuBar* pMenuBar = pCommandBars->SetMenu(
  _T("Menu Bar"), IDR_MAINFRAME);
 if(pMenuBar == NULL)
 {
  TRACE0("Failed to create menu bar.\n");
  return -1;      // fail to create
 }
 
Now I want to get the hendle of MDI menu.
I have used following code for the same
 
HMENU hMenu = GetMenu()->GetSafeHmenu();
 
or
 
CMainFrame * pFrame = (CMainFrame *)AfxGetMainWnd();
CMenu * pMenu = pFrame->GetMenu();
 
But I am getting NULL value.
 
How do I get the HMENU of the MDI Menu?
 
Please Help me
 
Thanks,
Makarand
 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net