Click here to Skip to main content
11,478,902 members (65,543 online)
Click here to Skip to main content

MDI Windows Manager Dialog

, 29 Apr 2000 105.6K 2.4K 35
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

    Share

    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 Pin
    Raymond_Gimilio26-Feb-07 8:32
    memberRaymond_Gimilio26-Feb-07 8:32 
    GeneralRe: Useful example for improving MFC knowledge [modified] Pin
    Ivan Zhakov26-Feb-07 8:58
    memberIvan Zhakov26-Feb-07 8:58 
    GeneralWindow manager conflicts with tab control... Pin
    atali21-Oct-04 6:52
    memberatali21-Oct-04 6:52 
    QuestionHow to add list of Documents as Tree Items??? Pin
    mahatma_cis5-Aug-04 4:23
    membermahatma_cis5-Aug-04 4:23 
    Generalquestion Pin
    lehaiquang17-Sep-03 21:31
    susslehaiquang17-Sep-03 21:31 
    Generaltree Pin
    yaser30-Aug-02 11:42
    memberyaser30-Aug-02 11:42 
    GeneralFit a dialog in a View of a Window Pin
    Anonymous17-Apr-02 9:55
    memberAnonymous17-Apr-02 9:55 
    GeneralRe: Fit a dialog in a View of a Window Pin
    Jim Busse13-Nov-02 11:27
    memberJim Busse13-Nov-02 11:27 
    Hopefully you got an answer by now.

    I get the size by using GetSystemMetrics. Here's a couple of lines from a window sizing routine that was dividing windows into 1/4 - 3/4 sizes. I think you can use the same function to size your dialog box. Hope this helps

    cs.cy = ::GetSystemMetrics(SM_CYSCREEN);
    cs.cx = ::GetSystemMetrics(SM_CXSCREEN) / 4;

    The cy and cx are members of the CREATESTRUCT, and you can probably insert the data in your dialog create structure.

    Jim
    GeneralHorizontal Scroll Bar Pin
    George Poulose1-May-00 19:45
    sussGeorge Poulose1-May-00 19: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 | Terms of Use | Mobile
    Web02 | 2.8.150520.1 | Last Updated 30 Apr 2000
    Article Copyright 2000 by Ivan Zhakov
    Everything else Copyright © CodeProject, 1999-2015
    Layout: fixed | fluid