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

OutlookTabCtrl, like CBCGPOutlookBar (in Mode2003)

, 17 Dec 2008 CPOL
Rate this:
Please Sign up or sign in to vote.
Control with modern design for multiple uses


Recently in one of my programs, I would have needed to use a CBCGPOutlookBar control (in Mode2003) from the BCGControlBar library. It is created as a ControlBar object and it is possible to bind it at the left or right side of a frame. I was not able to put it to the -- necessary for me -- float state. Also, it is not possible to create it as a child for any window, e.g. to put it on the dialog. The control that I created is derived from CWnd and is a common control based on MFC. It does not have restrictions and it is possible to put it on any window (main frame, dialog, float bar (ControlBar), etc).

Using the Code

The control includes three hierarchical classes:






Base class. Includes all the base functionality, but it does not draw or display the menu and setting dialog.



Derived from OutlookTabCtrlBase. Overrides and implements the virtual methods that are necessary to draw the control and save its state to the registry.



Derived from OutlookTabCtrl. Overrides and implements a single virtual method, ShowMenu. It shows the menu and, if it is possible, shows the dialog based on the OutlookTabCtrlCmdDialog class.

To create the control and add elements to it, you can do the next steps:

OutlookTabCtrlEx m_OutlookTabCtrlEx;
CListCtrl m_List1, m_List2;


    WS_CHILD | WS_VISIBLE | WS_BORDER,CRect(3,3,200,350),
    return -1;    // error.

CImageList imagelistBig, imagelistSmall;
CBitmap bmpBig, bmpSmall;

// Create ImageList for big icons.
imagelistBig.Create(24,24,ILC_COLOR24 | ILC_MASK,2,0);

// Create ImageList for small icons.
imagelistSmall.Create(16,16,ILC_COLOR24 | ILC_MASK,2,0);


// Create child controls.
if(m_List1.Create(WS_CHILD | WS_CLIPCHILDREN | LVS_REPORT,CRect(0,0,0,0),
    &m_OutlookTabCtrlEx,ID_List1)==0 ||
    m_List2.Create(WS_CHILD | WS_CLIPCHILDREN | LVS_REPORT,CRect(0,0,0,0),
    return -1;    // error.

// Add child items in the m_OutlookTabCtrlEx.
if(m_OutlookTabCtrlEx.AddTab(&m_List1,"Mail",0,0)==NULL ||
    return -1;    // error.

// Load state from registry.
    m_OutlookTabCtrlEx.PushTab();    // error - create default state.


Windows for all new added elements should have the unique identifiers. Elements can be in the state of a tab or button. By default, an element is added as a tab. Using the Insert function, it is possible to add the element to the random position. Remove changes the position. The control is expected to call the Update function to show the results that are set by functions Delete, SetItemWnd, ShowItem, etc. The control can hide the element (ShowItem) or block it (Disable) and get an index between visible elements (GetVisibleIdxByHandle) or all elements in the control (GetIdxByHandle).

Also, it is possible to check the existence of the element (IsExist) or position it below the mouse cursor (HitTest). The control is able to save and load its state from the registry or other source (LoadState/SaveState). This is just a part of the possibilities. To get the full power, look at the opened and closed interfaces of the OutlookTabCtrlBase and OutlookTabCtrl classes, as well as the OutlookTabCtrlExCustom class for creating the user interface of the control.

Good luck.


  • 4 October, 2007 -- Original version posted
  • 11 October, 2007 -- Fixed problem with addition Dialog as child control; added functions SetLayout and SetButtonsAlign for determination places of the control's areas
  • 17 December, 2008 -- Just corrected some small errors


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Borodenko Oleg
Software Developer Closed JSC 'Phazotron-7'
Belarus Belarus
No Biography provided

Comments and Discussions

Questionrun error,"gettextextent" ,use vs2010 .thank you Pinmemberletiantxf5-Sep-14 1:34 
AnswerRe: run error,"gettextextent" ,use vs2010 .thank you PinmemberBorodenko Oleg5-Sep-14 2:30 
GeneralRe: run error,"gettextextent" ,use vs2010 .thank you Pinmemberletiantxf7-Sep-14 4:57 
GeneralRe: run error,"gettextextent" ,use vs2010 .thank you PinmemberBorodenko Oleg7-Sep-14 14:14 
GeneralRe: run error,"gettextextent" ,use vs2010 .thank you Pinmemberletiantxf12-Sep-14 4:55 
GeneralRe: run error,"gettextextent" ,use vs2010 .thank you Pinmemberletiantxf12-Sep-14 5:00 
GeneralRe: run error,"gettextextent" ,use vs2010 .thank you PinmemberBorodenko Oleg13-Sep-14 10:40 
GeneralRe: run error,"gettextextent" ,use vs2010 .thank you [modified] Pinmemberletiantxf16-Sep-14 22:35 
QuestionTabs, splitter and windows layout PinmemberMember 96655013-Apr-13 3:06 
AnswerRe: Tabs, splitter and windows layout PinmemberBorodenko Oleg3-Apr-13 8:01 

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
Web01 | 2.8.141223.1 | Last Updated 17 Dec 2008
Article Copyright 2007 by Borodenko Oleg
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid