Solved

Showing the list of open documents in the Windows Menu

Posted on 1999-01-07
6
749 Views
Last Modified: 2013-11-20
How dow you get the List of Open Documents in an MDI application to show on the Window Sub Menu?  If I create a new MDI application from the Wizard I get it for free, but the application I am currently working on I cannot get the list.
0
Comment
Question by:traott
  • 3
  • 2
6 Comments
 
LVL 3

Expert Comment

by:plaroche
ID: 1327356
The Window menu is automatically updated by MFC. There is a kludge in the code which makes some applications not to behave properly.

MFC assumes the Window menu is the second from the right, assuming the last one is the help menu. This "assuming" is considered ok because it is a standard thorugh all Windows applications.

I'm  willing to bet that you have removed the help menu or added a new menu and that your WINDOW menu isn't second from the right.
0
 

Author Comment

by:traott
ID: 1327357
I checked my menu setup and I do have the Window menu in the correct position (second from the right) and I am still not getting a window list. Is there something else I need to do?
0
 
LVL 3

Expert Comment

by:plaroche
ID: 1327358
Are you handling WM_MDIREFRESHMENU in any way? This message tells the MDI client window to refresh the window menu.  Maybe one of your overrides bypasses that message.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

Author Comment

by:traott
ID: 1327359
I am not handling WM_MDIREFRESHMENU anywhere. When I create a new document the menu is getting updated, so if I close all documents then the simplistic menu for no documents are there, and if I open a document then the menu get replace by the correct menu.  I had to subclass the CMDIDocTemplate class to handle a specific case of opening my file type, but everything I have read says that this should not affect the updating of the menu.  Am I mistaken and have to handle the refresh of the menu because of this?
0
 
LVL 15

Accepted Solution

by:
Tommy Hui earned 100 total points
ID: 1327360
If you look in GetWindowMenuPopup() in winmdi.cpp, you will see that MFC searches through your entire menu looking for menu items in the range of AFX_IDM_WINDOW_FIRST to AFX_IDM_WINDOW_LAST. It returns the HMENU of the first submenu that contains those items. Typically, if you have a submenu with either ID_WINDOW_NEW, ID_WINDOW_ARRANGE, _CASCADE, _TILE_HORZ, _TILE_VERT or _SPLIT, then MFC will find the menu.

To fix this problem, make sure you have a submenu with those items in it. Or since the GetWindowMenuPopup() is virtual, in your derived class of CMDIFrame, you can override it to return the proper HMENU.
0
 
LVL 3

Expert Comment

by:plaroche
ID: 1327361
If you're not bypassing standard behavior it shouldn't be a problem.

One thing you might want to try, look at the MFC source code in WINMDI.CPP, there are several occurances of WM_MDIREFRESHMENU.  place a breakpoint on each of them and try to manipulate your app so that each breakpoint gets executed.

If some of them aren't reached, place a breakpoint at the beginning of the function, try to see why the message isn't sent.

It's something that won't take too long to try I think.

Also, if your project isn't too big or too far into I could try to check it out.  EMail at: plaroche@cybectec.com.  I've done it a couple times for other questions ans was able to find the problem.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Installing Microsoft R server on REDHAT or SUSE Linux 4 131
Separate into files by filename 12 76
Process filename extension 3 172
while loop over for loop 7 93
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now