Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

MDI Windows Manager Dialog

0.00/5 (No votes)
29 Apr 2000 1  
Implementing "Windows..." dialog
  • Download source files - 4.6 Kb
  • Download demo project - 36.5 Kb
  • Sample Image - WindowsManager.gif

    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.

    License

    This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

    A list of licenses authors might use can be found here