Download source files - 4.6 KbDownload demo project - 36.5 Kb
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;
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.