Click here to Skip to main content
15,614,943 members
Articles / Desktop Programming / WTL
Posted 22 Mar 2001


83 bookmarked

Outlook Bar Control and Frame (WTL)

Rate me:
Please Sign up or sign in to vote.
5.00/5 (6 votes)
27 Jun 2001
An outlook control and framework that can be used in your WTL Application

Sample Image - atloutlookbar3.gif

Credit and Acknowledgments

First of all I would like to credit the Original Author Iuri Apollonio on the fantastic control that he has developed using MFC. His code has been used to port the control to WTL with a few WTL tweaks and fixes. The original article can be found at

The Outlook caption bar is based on the Window Caption Bar written by Maxime Labelle, the original article can be found at

The Flatbutton on the caption bar is based on Davide Calabro's excellent CButtonST class, that has been ported to WTL. The Flatbutton class has been extended to include functionality to get the outlook flatbutton style.


I needed a Outlook bar to use in a ATL/WTL project, my attention turned to Iuri Apollonio Outlook bar Control that was MFC based and this article basically ports the original CGfxOutBarCtrl. Three ATL files contain the port.
  • atloutbarctrl.h (Contains the main COutBarCtrl Class for WTL)
  • atlgroupedit.h (Contains the CGroupEdit class for WTL and used by the COutBarCtrl Class)
  • atloutbarsplit.h (Contains the COutlookSplitterWindow class for WTL and used by the COutBarCtrl Class)

The caption bar can be found in

  • atlcaptionbar.h (Contains the main CCaptionBar)

The flatbutton class can be found in

  • atlflatbutton.h (Contains the main CButtonST class)

The COutlookSplitterWindow bar is inherited from the WTL CSplitterWindow class, additional functionality had to be added to make the left pane aligned (i.e. left pane does not move width wise when the app is resized). This functionality strangely exist in the base class for a right pane. Further tweks had to be added to make it act like a outlook splitter. The original CGfxSplitterWindow has not been ported as MFC and WTL splitter classes vary.


You will require the WTL Libraries, these can be downloaded from the microsoft site, there are various articles on the net that tell you how to do this, so I won't bore you with the details.

Note - This control uses the WTL CString class and the STL std::list template class.

How to use the control in your WTL App

  1. Make sure you have the following ATL files included in your stdafx.h

    • atlwin.h
    • atlctrls.h
    • atlmisc.h

    atlmisc.h is required as it has the definition for the WTL CString Class

  2. Add the header file atloutbarctrl.h and atloutbarsplit.h to the Main frame class and declare an instance of the Outlook bar control, Outlook Bar Splitter objects and the Image Lists that are to be used in the outlook bar.
    COutBarCtrl wndBar;
    CImageList imaLarge, imaSmall;
    COutlookSplitterWindow m_splitter
  3. Create the outlook splitter class e.g.
    m_hWndClient = m_splitter.Create(m_hWnd, rect, NULL, 
  4. Create the outlook bar control and set the image lists on the OnCreate function in the Main Frame class e.g.
    DWORD dwf = COutBarCtrl::fDragItems|COutBarCtrl::fEditGroups|
    if (!wndBar.Create(WS_CHILD|WS_VISIBLE, CRect(0,0,0,0), 
        m_splitter.m_hWnd, 1234, dwf)) 
       DWORD word = GetLastError(); 
       return 0; 
    imaLarge.Create(IDB_IMAGELIST, 32, 0, RGB(128,128,128));
    imaSmall.Create(IDB_SMALL_IMAGELIST, 16, 0, RGB(0,128,128));
    wndBar.SetImageList(&imaLarge, COutBarCtrl::fLargeIcon);
    wndBar.SetImageList(&imaSmall, COutBarCtrl::fSmallIcon);
    wndBar.AddFolder("Folder 1", 0);
    wndBar.AddFolder("Folder 2", 1);
    wndBar.AddFolder("Folder 3", 2);
    wndBar.InsertItem(0, 0, "Item 1", 0, 0);
    wndBar.InsertItem(0, 1, "Item 2", 1, 0);
    wndBar.InsertItem(0, 2, "Item 3", 2, 0);
  5. You need to set a few of the splitter methods for it to act like a outlook splitter.
    m_splitter.m_bFullDrag = false; // Draws the Ghost bar instead
      // Aligns the outlook bar to the left
    m_splitter.SetSplitterPanes(wndBar, m_list); 
      // Set the outlook bar on the left pane
    m_splitter.SetSplitterPos(120); // width of the initial outlook bar
  6. To receive Events on when the tab has been selected add the Macro to the message Map.

    On the onNotify handler, trap the Events.

    LRESULT OnOutbarNotify(UINT /*uMsg*/, WPARAM wParam, 
        LPARAM lParam, BOOL& /*bHandled*/)
       switch (wParam)
          case NM_OB_ITEMCLICK:
        // cast the lParam to an integer to get the clicked item
           int index = (int) lParam;
         CString cs, cs1;
         cs1 = wndBar.GetItemText(index);
         cs.Format("Clicked on %d - <%s>", (int)lParam, cs1);
         MessageBox(cs, "Outlook Bar", MB_OK);
        return 0;
        // cast the lParam to an OUTBAR_INFO * struct; 
        // it will contain info about the edited item
           OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam;
        return 1;
        // cast the lParam to an OUTBAR_INFO * struct; 
        // it will contain info about the edited folder
           OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam;
        return 1;
        case NM_OB_DRAGITEM:
        // cast the lParam to an OUTBAR_INFO * struct; 
        // it will contain info about the dragged items
           OUTBAR_INFO * pOI = (OUTBAR_INFO *) lParam;
        return 1;
       return 0;

The Demo App shows how to use the control in full.


  • v1.00 - Initial Port
  • v1.01 - Added Outlook Caption Bar to demo app also shows how to use nested vertical and horizontal splitter bar to get outlook feel. Fixed potential painting problem in outlook control when resizing the application.
  • v1.02 - Extended the Outlook framework, by adding the flat button on the caption bar. Also uses panes to lock and unlock the floating tree window.


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

Written By
Web Developer
United Kingdom United Kingdom
Was made redundant in early 2003 after 10 years in computer programming, since then started my own business (selling computer books on the net)

Comments and Discussions

GeneralTooltips for the items Pin
daphna2-Feb-05 18:15
daphna2-Feb-05 18:15 
Questionhow to add outlook bar to a MDI project? Pin
Anonymous25-Nov-03 14:15
Anonymous25-Nov-03 14:15 
Questioncompilation Error? Pin
murali_utr7-Oct-03 22:29
murali_utr7-Oct-03 22:29 
GeneralMessage Loop Pin
donno2020-Aug-03 23:27
donno2020-Aug-03 23:27 
GeneralRe: Message Loop Pin
Cui Sheng8-Mar-04 14:09
Cui Sheng8-Mar-04 14:09 
Generaladvanced usage Pin
Modar4-May-03 7:46
Modar4-May-03 7:46 
QuestionGDI Problems after 800-1000 WM_PAINT messages? Pin
Ismail Ufuk PAZARBASI30-Mar-03 10:54
Ismail Ufuk PAZARBASI30-Mar-03 10:54 
AnswerRe: GDI Problems after 800-1000 WM_PAINT messages? Pin
Steve Mayfield30-Mar-03 12:22
Steve Mayfield30-Mar-03 12:22 
GeneralC# Version Pin
mokah19-Mar-03 6:56
mokah19-Mar-03 6:56 
GeneralSmall icons, long labels Pin
Paul Vickery17-Feb-03 4:18
professionalPaul Vickery17-Feb-03 4:18 
GeneralIcon background color problem. Pin
Ilushka13-Nov-02 22:21
Ilushka13-Nov-02 22:21 
QuestionAre 256 color icons possible? Pin
clintsinger7-Aug-02 12:52
clintsinger7-Aug-02 12:52 
Generalmap the message Pin
Anonymous30-Jul-02 20:35
Anonymous30-Jul-02 20:35 
GeneralAddding Button to Standard OutLook Toolbar Pin
ajith7-Apr-02 20:59
ajith7-Apr-02 20:59 
GeneralReceiving and Sending email or Creating/Viewing tasks Pin
8-Nov-01 8:56
suss8-Nov-01 8:56 
GeneralAnotjher minor drawing detail Pin
3-Jul-01 2:28
suss3-Jul-01 2:28 
GeneralRe: Anotjher minor drawing detail Pin
Rashid Thadha3-Jul-01 11:54
Rashid Thadha3-Jul-01 11:54 
GeneralMinor drawing detail Pin
3-Jul-01 2:20
suss3-Jul-01 2:20 
GeneralRe: Minor drawing detail Pin
Rashid Thadha3-Jul-01 11:54
Rashid Thadha3-Jul-01 11:54 
Generalcompiled error Pin
26-Jun-01 20:41
suss26-Jun-01 20:41 
GeneralRe: compiled error Pin
Rashid Thadha27-Jun-01 3:18
Rashid Thadha27-Jun-01 3:18 
Generalwont compile. Pin
8-May-01 13:37
suss8-May-01 13:37 
GeneralRe: wont compile. Pin
Rashid Thadha8-May-01 22:55
Rashid Thadha8-May-01 22:55 
Generala bug... Pin
nullpointer5-May-01 9:55
nullpointer5-May-01 9:55 
GeneralRe: a bug... Pin
10-May-01 6:29
suss10-May-01 6:29 

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.