MDI Windows Manager dialog

Environment: VC++ 5.0; NT 4.0

What’s this?

This article describes how to implement Windows Manager dialog. It manages currently open windows
(Activate, Save, Close, Tile, Cascade, Minimize)

How to use it?

1. Add to your CMainFrame class member variable of type CMDIClient A good practice is to keep the variables protected (or private).

2. Then within OnCreate() handler add a 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 IDD_WINDOW_MANAGE dialog (from WindowManager.rct).

4. Add folowing resource strings:

    ID Caption Description
    IDS_WINDOW_WINDOWS “&Windows…” Menu text
    ID_WINDOW_MANAGE “Manages the currently open windows.\nWindow List” Message prompt

5. Add handler to command ID_WINDOW_MANAGE and add a following code.


    void CMainFrame::OnWindowManage()
    {
    m_MDIClient.ManageWindows(this);
    }

6. Build and run your application.

7. Go to Window menu and click Windows…

Unicode?

Not tested, but should work.

Downloads

Download demo project – 41,3 KB
Download source – 4,6 KB

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read