Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Command Bars
  New Posts New Posts RSS Feed - how to replace CMainFrame->GetMenu() in codejock
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

how to replace CMainFrame->GetMenu() in codejock

 Post Reply Post Reply
Author
Message
Pearl View Drop Down
Newbie
Newbie


Joined: 17 September 2007
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote Pearl Quote  Post ReplyReply Direct Link To This Post Topic: how to replace CMainFrame->GetMenu() in codejock
    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?
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.