Re: Substituting the main menu bar(s)



Take a look at
http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=GGLD,GGLD:2004-
11,GGLD:en&q=How+to+Use+Multiple+Menus+in+MFC+App+That+Uses+GetDefaultMenu

Victor


"David Webber" <dave@xxxxxxxxxxxxxxxxxxx> wrote in message
news:eGm8XT#hGHA.3756@xxxxxxxxxxxxxxxxxxxxxxx

"Ajay Kalra" <ajaykalra@xxxxxxxxx> wrote in message
news:1149267162.949599.291930@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

But even so, the program knows about two menus: one for when an MDI
document
is open, and one for when one isn't. I need to replace both.

You can do that as well...

Thanks Ajay,

I have been exploring the MFC source code and I think I can make it work.

For the menus shown when there is a document present then from the CWinApp
derived class one can do

POSITION pos = GetFirstDocTemplatePosition();

while( pos )
{
CDocTemplate *pDocTemplate = GetNextDocTemplate( pos );

// Cast this UP to CMultiDocTemplate - it is one!
// Replace its m_hMenuShared with my new HMENU for the document.
.......
}

I am a bit nervous about needing the upward cast (on the principle that
something is usually awry if an upward cast is needed) but I can use
IsKindOf to check the legality, and it works. And there seems to be no
way
round it.

For the menu when no document is present, as you say, I can replace the
m_hMenuDefault of the base class of my main frame window.

Now I need to be tidy. I am assuming that each document type stores a
menu
handle in its CMultiDocTemplate::m_hMenuShared and the menu for no
document
open is stored in CFrameWnd::m_hMenuDefault, AND that MFC simply uses
SetMenu() to select between them as document windows open and close,
without
destroying the previously selected menu.

If so, when I replace the stored menus, it looks like I should be
destroying
the old menus and simply using SetMenu() using the appropriate one of the
new ones.

I'll suck it and see.

Dave
--
David Webber
Author MOZART the music processor for Windows -
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm







.



Relevant Pages

  • Re: Substituting the main menu bar(s)
    ... I have been exploring the MFC source code and I think I can make it work. ... POSITION pos = GetFirstDocTemplatePosition; ... something is usually awry if an upward cast is needed) but I can use ... SetMenuto select between them as document windows open and close, ...
    (microsoft.public.vc.mfc)
  • Re: Help reqd for PC legacy software to Mac
    ... I am assuming you are using this POS application for some kind of retail ... memory you need to make VPC go well on a cheap Apple. ... The Mac Mini will produce about the same VPC performance as the iBook I am ... I would certainly stick with Windows 98SE. ...
    (microsoft.public.mac.virtualpc)
  • Re: basic install
    ... Windows 2003 is a server product only. ... network with 10-20 terminals accessing the POS folder on the back office ... you dont want the general staff on the back office computer at all. ... One of the largest POS software companies uses a thin ...
    (microsoft.public.windows.server.sbs)
  • Re: Visa doesnt do a good job of painting
    ... Have these POS specific suppliers assured you that they will be able to furnish machines with licensed copies of XP after January 31, ... See the reference to "System Builders" at the end of the "Future of Windows XP" section in this letter from Bill Veghte, senior vice president of the Online Services & Windows Business group. ... I've been careful to write all the business objects for our newest version of the software so that they are as compatible as possible with Lazarus/Freepascal and Delphi. ...
    (borland.public.delphi.non-technical)
  • Re: Windows XP Home :-(
    ... >I have a problem with my girlfriends PC and Windows XP home. ... > this OS a total POS? ... > She purchased a brand new Toshiba Sattelite V70, ... > laptops with this OS. ...
    (microsoft.public.windowsxp.help_and_support)