Click here to Skip to main content
Click here to Skip to main content

MDI Windows Manager Dialog

, 29 Apr 2000
Rate this:
Please Sign up or sign in to vote.
Implementing "Windows..." dialog
<!-- Link to source file download -->
  • Download source files - 4.6 Kb
  • <!-- Link to demo file download -->
  • Download demo project - 36.5 Kb
  • <!-- Article image -->

    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

    About the Author

    Ivan Zhakov
    Chief Technology Officer
    Russian Federation Russian Federation
    I started with programming more than ten years ago when I was teenager.
    Since that time I had experience varying from Windows desktop applications to embedded Linux development.
    For present time I'm developer of the Subversion Project and also co-founder of the VisualSVN company which develops integration between Subversion and Microsoft Visual Studio.

    Comments and Discussions

     
    GeneralUseful example for improving MFC knowledge PinmemberRaymond_Gimilio26-Feb-07 7:32 
    Very useful example for newbees.
     
    Thanks!Smile | :) Smile | :) Big Grin | :-D Laugh | :laugh: Laugh | :laugh:
     
    Raymond GIMILIO
    CDS/ISIS-UNESCO expert

    GeneralRe: Useful example for improving MFC knowledge [modified] PinmemberIvan Zhakov26-Feb-07 7:58 
    GeneralWindow manager conflicts with tab control... Pinmemberatali21-Oct-04 5:52 
    QuestionHow to add list of Documents as Tree Items??? Pinmembermahatma_cis5-Aug-04 3:23 
    Generalquestion Pinsusslehaiquang17-Sep-03 20:31 
    Generaltree Pinmemberyaser30-Aug-02 10:42 
    GeneralFit a dialog in a View of a Window PinmemberAnonymous17-Apr-02 8:55 
    GeneralRe: Fit a dialog in a View of a Window PinmemberJim Busse13-Nov-02 10:27 
    GeneralHorizontal Scroll Bar PinsussGeorge Poulose1-May-00 18:45 

    General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

    | Advertise | Privacy | Mobile
    Web01 | 2.8.140721.1 | Last Updated 30 Apr 2000
    Article Copyright 2000 by Ivan Zhakov
    Everything else Copyright © CodeProject, 1999-2014
    Terms of Service
    Layout: fixed | fluid