Print Page | Close Window

GetMenu doubt in commandbar?

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=9299
Printed Date: 13 September 2025 at 10:46pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: GetMenu doubt in commandbar?
Posted By: Ashok
Subject: GetMenu doubt in commandbar?
Date Posted: 14 January 2008 at 6:58am
Hi,
 What is the equivalent code for this statement in the CommandBar
       m_pMainWnd->GetMenu();
 because it returns NULL in my application. Please help.



Replies:
Posted By: Oleg
Date Posted: 14 January 2008 at 9:37am

Hi,

There is no HMENU in CommandBars.
use GetCommandBars()->GetMenuBar() to get pointer to menubar. but its not CMenu.


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


Posted By: mihey
Date Posted: 28 January 2008 at 4:29am

Hi Ashok,

You are not the first one who ask about this. Maybe Codejock guys have to consider making a solution for this.

I also had the same problem and had to patch CXTPCommandBar and CXTPMenuBar a little bit. I've made it in this way because I did not want to change handling of menus in my application which was very complex due to exposing an object model via COM and based on old version of XtremeToolkit where GetMenu worked.  

 

In XTPCommandBar.h I added member

 

HMENU                         m_hLoadedMenu;

 

 

In XTPCommandBar.cpp I added before return

 

BOOL CXTPCommandBar::LoadMenu(CMenu* pMenu, BOOL bRemoveControls)

{

           

            // ----

            if (bRemoveControls) m_hLoadedMenu=pMenu->m_hMenu;

            // ----

            return TRUE;

}

 

 

In XTPMenuBar.h I just defined method

 

CMenu* GetMenu( ) const;

 

And added the implementation in XTPMenuBar.cpp

 

CMenu* CXTPMenuBar::GetMenu() const

{

            return CMenu::FromHandle(m_hLoadedMenu);

}

So, now I can acces loaded menu via GetCommandBars()->GetMenuBar()->GetMenu() and it works fine for me but I have to pach it in each new version of XTP.  Of course this is not a universal method but at least it works in case of loading menus from recourses.

 Best regards, Mikhail


Posted By: Ashok
Date Posted: 28 January 2008 at 8:06am
Hi, Thanks a lot.


Posted By: Ashok
Date Posted: 05 February 2008 at 7:03am
I have uploaded a file which contains my doubt.please look into this issue. https://forum.codejock.com/uploads/20080205_070302_test.rar - uploads/20080205_070302_test.rar


Posted By: Oleg
Date Posted: 05 February 2008 at 12:54pm
Hi,
 
Most our samples in CommandBars forlder show MDI/Default menus.
 
Please look all CommandBars samples.


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


Posted By: Ashok
Date Posted: 06 February 2008 at 12:19am
Hi, I understand that all your commandbar samples are having MDI Menu. My problem is when ever there is a MDIActive(means window list will have Data1,Page1etc.,),I have to set my full menu, if there is nothing in the window list(means if i closed all my active view) I have to set another menu. Please help.


Posted By: Oleg
Date Posted: 06 February 2008 at 9:02am
Hello,
Yes and our samples show it. Seriously 120 messages and you have no idea what CommandBars can do. Please check all samples and try to understand how they work.


-------------
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