Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


Showing the list of open documents in the Windows Menu

Posted on 1999-01-07
Medium Priority
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.
Question by:traott
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2

Expert Comment

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.

Author Comment

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?

Expert Comment

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.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Author Comment

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?
LVL 15

Accepted Solution

Tommy Hui earned 400 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.

Expert Comment

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.

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

597 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