简体   繁体   中英

How is the Windows menu in a MFC C++ app populated

One of the standard menus provided to a Document/View app under MFC is the Windows menu. It provides things like tiling and cascading windows, and appends an enumerated list of currently available views at the end of the menu. Problem is, sometimes it doesn't and I'd like to know why. More specifically, I'd like to know how to refresh this list as I'd like to use it under a GUI automation tool. Usually the list is there, sometimes it's not, anyone know why? My guess is that there is a function deep within the CFrameWnd class to look after this but I can't seem to find it.

Edit: I'm also using the Stingray library for GUI which could well have a bearing on the problem.

Updating the menu and the window title are handled separatelly in two methods.

  • CFrameWnd::OnUpdateFrameMenu(..) actualises only the frame menu,
  • CFrameWnd::OnUpdateFrameTitle(..) refreshes only the name of the frame.

I think there is somewhere a wrong call order and updating the title will be later than updating the menu. After all that title in Window menu remains an empty string sometimes.

The simplest way to repair is by using the GetActiveFrame()->ActivateFrame() method call. It will refresh immediatelly the actual frame window and the owned Window menu too. It can be used after creating the CDocument and the CView. The best place to call it is in end of OnFileNew , OnFileOpen overridden methods of (CWin)App class of application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM