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
Solved

Showing the list of open documents in the Windows Menu

Posted on 1999-01-07
6
762 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
cat dog challenge 18 126
ORA-01403: no data found 43 106
Fibonacci challenge 11 133
Making an alias 7 101
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.

856 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