MDI Windows Manager Dialog






4.47/5 (12 votes)
Apr 27, 2000

122339

2744
Implementing "Windows..." dialog
What's this?
This article describes how to implement a Windows Manager dialog. It manages currently open windows (Activate, Save, Close, Tile, Cascade, Minimize).
How to use it?
1. Add to your CMainFrame
a class member variable of type CMDIClient
. A good practice is to keep
the variables protected (or private).
2. Then, within the OnCreate()
handler, add the following code:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; // Subclass the MDI client window VERIFY(m_MDIClient.SubclassWindow(m_hWndMDIClient)); return 0; }
3. Copy to your project the provided IDD_WINDOW_MANAGE dialog resource (from WindowManager.rct).
4. Add the following resource strings:
ID | Caption | Description |
---|---|---|
IDS_WINDOW_WINDOWS | "&Windows..." | Menu text |
ID_WINDOW_MANAGE | "Manages the currently open windows.\nWindows List" | Message prompt |
5. Add a handler to command ID_WINDOW_MANAGE and add the following code.
void CMainFrame::OnWindowManage() { m_MDIClient.ManageWindows(this); }
6. Build and run your application.
7. Go to Window menu and click on "Windows..."
Unicode?
Unicode has not been tested, but it should work.