Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Get CMenu from CXTPCommandBars?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Get CMenu from CXTPCommandBars?

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


Joined: 09 February 2004
Location: United States
Status: Offline
Points: 17
Post Options Post Options   Thanks (0) Thanks(0)   Quote dmetzler Quote  Post ReplyReply Direct Link To This Post Topic: Get CMenu from CXTPCommandBars?
    Posted: 18 March 2004 at 6:33pm

How can I get a CMenu from an existing menu bar?

CXTPCommandBars* pCommandBars = GetCommandBars();

CXTPCommandBar* pMenuBar = pCommandBars->GetMenuBar() ;

Now - how to get the CMenu object from the pMenuBar?

Thanks,

Don Metzler

 

Back to Top
vladsch View Drop Down
Newbie
Newbie


Joined: 04 February 2004
Location: Canada
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote vladsch Quote  Post ReplyReply Direct Link To This Post Posted: 26 March 2004 at 12:40pm

I don't think there is a way to get a CMenu from the current state of the menu bar.

There is a member of CXTPMenuBar m_hMenuDefault that is a menu handle of the default menu loaded into the menu bar but it is set via:

m_hMenuDefault = ::GetMenu(GetSite()->GetSafeHwnd());

So you can just get that yourself without the menu bar.

I don't think this is of help in your case. You can build up a menu from the Controls of the menu bar by reversing the proces of the LoadMenu function in XTPCommandBar.cpp. The function is very simple and straight forward, and would not be a very big job to write its reverse.

Unless you need to pass the CMenu* to a function out of your control it would probably be easier to rewrite your code to deal directly with the XTP classes and functions. Of course unless you don't want to be permanently married to the XTP implementation. 

I did rewrite my code in terms of the XTP classes and it simplified my code enourmously.


 

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.188 seconds.