Print Page | Close Window

how to replace CMainFrame->GetMenu() in codejock

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Command Bars
Forum Description: Topics Related to Codejock Command Bars
URL: http://forum.codejock.com/forum_posts.asp?TID=8053
Printed Date: 03 March 2025 at 4:47am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: how to replace CMainFrame->GetMenu() in codejock
Posted By: Pearl
Subject: how to replace CMainFrame->GetMenu() in codejock
Date Posted: 17 September 2007 at 6:33pm
Hi,
 
I am using codejock to reskin the old MFC 6.0 application. Since codekock doesn't support application menu (the menu is hide in title bar), ao I create the menu bar by following the sample code.
 
 if (!InitCommandBars())
   return -1;
 
// Get a pointer to the command bars object.
    CXTPCommandBars* pCommandBars = GetCommandBars();
 
 if(pCommandBars == NULL)
 {
  TRACE0("Failed to create command bars object.\n");
  return -1;      // fail to create
 }
   // create the menubar.
 pMenuBar = pCommandBars->SetMenu(_T("Menu Bar"), IDR_MAINFRAME);
 
    if(pMenuBar == NULL)
 {
  TRACE0("Failed to create menu bar.\n");
  return -1;      // fail to create
  }
 
 However, if I create the menu like this way, I am not able to CMainFrame->GetMenu(), the pointer is null. I have lots of code of getting main menu by this way , and corresponding methods (llike CheckMenuItem). How can I change the code to let them working?



Replies:
Posted By: Oleg
Date Posted: 18 September 2007 at 1:55am
Hello,
Afraid you need rewrite it :(
 
Instead CMainFrame->GetMenu use
GetCommandBar()->GetMenuBar()
 
and use CXTPControls/ CXTPControl methods to add/remove/modify items.


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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