Click here to Skip to main content
11,921,316 members (62,237 online)
Click here to Skip to main content
Add your own
alternative version


40 bookmarked

A simple tabbed MDI for WTL

, 22 Dec 2001
Rate this:
Please Sign up or sign in to vote.
Add a simple tab control that shows the opened child windows in an MDI application

Sample Image - wtlmditab.gif


This class adds a simple tab control in a WTL based MDI application. It is partly based on the freeware MFC version from Dundas Software available at


First include the header file and create a CMDITabImpl member in the main frame class.

#include <span class="code-string">"atlmditab.h"

class CMainFrame : public ....
    CMDITabImpl<CMainFrame> m_TabbedMDI;

Then attach to the control in main frame's OnCreate(..) function

LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, 
    LPARAM /*lParam*/, BOOL& /*bHandled*/)

Then you must add an UpdateLayout() function in main frame to place the tab control correctly. If anybody finds a solution for WTL that won't require this extra code, please let me know.

void UpdateLayout(BOOL bResizeBars = TRUE)
    RECT rect;
    // position bars and offset their dimensions
    UpdateBarsPosition(rect, bResizeBars);
    m_TabbedMDI.UpdateTabLayout(m_hWndClient, rect);


This class is written for learning WTL, so there are surely lots of bugs in the implementation. And some features are not implemented yet, like icon support and context menu. I will work on them later when I get more time. Cheers.


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

David Y. Zhao
Web Developer
Sweden Sweden
No Biography provided

You may also be interested in...

Comments and Discussions

Questionm_wndMDIClient Pin
XiaoK Lin15-Apr-12 5:10
memberXiaoK Lin15-Apr-12 5:10 
GeneralFails to build Pin
Anonymous29-Oct-02 5:09
sussAnonymous29-Oct-02 5:09 
I downloaded this project but I got the following errors when I attempted to build it:

j:\projects\test\mditabsample\extensions\atlcmdbar2.h(276) : error C2065: 'm_wndMDIClient' : undeclared identifier
j:\projects\test\mditabsample\extensions\atlcmdbar2.h(253) : while compiling class-template member function 'long __thiscall WTL::CCommandBarCtrlImpl2 >::OnInitMenuPopup(unsigned int,unsigned int,long,int &)'
j:\projects\test\mditabsample\extensions\atlcmdbar2.h(276) : error C2228: left of '.SendMessageA' must have class/struct/union type
j:\projects\test\mditabsample\extensions\atlcmdbar2.h(253) : while compiling class-template member function 'long __thiscall WTL::CCommandBarCtrlImpl2 >::OnInitMenuPopup(unsigned int,unsigned int,long,int &)'

Hmmm. Could it be that the project was developed using an earlier version of WTL and that the member m_wndMDIClient has been removed - from whichever base class it used to be in - in WTL7.0?

GeneralRe: Fails to build Pin
Yan.K22-Sep-04 16:07
memberYan.K22-Sep-04 16:07 
GeneralVery nice, but... Pin
Gavin Jerman11-Apr-02 5:37
memberGavin Jerman11-Apr-02 5:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    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
Web04 | 2.8.151120.1 | Last Updated 23 Dec 2001
Article Copyright 2001 by David Y. Zhao
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid