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

Outlook Bar Control and Frame (WTL)

, 27 Jun 2001
Rate this:
Please Sign up or sign in to vote.
An outlook control and framework that can be used in your WTL Application
<!-- Article image -->

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


About the Author

Rashid Thadha
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 Pinmemberdaphna2-Feb-05 19:15 
Questionhow to add outlook bar to a MDI project? PinsussAnonymous25-Nov-03 15:15 
Questioncompilation Error? PinsussMurali.M7-Oct-03 23:29 
GeneralMessage Loop Pinmemberdonno2021-Aug-03 0:27 
GeneralRe: Message Loop PinmemberCui Sheng8-Mar-04 15:09 
Generaladvanced usage PinmemberModar4-May-03 8:46 
QuestionGDI Problems after 800-1000 WM_PAINT messages? PinmemberIsmail Ufuk PAZARBASI30-Mar-03 11:54 
AnswerRe: GDI Problems after 800-1000 WM_PAINT messages? PinmemberSteve Mayfield30-Mar-03 13:22 
GeneralC# Version Pinmembermokah19-Mar-03 7:56 
GeneralSmall icons, long labels PinmemberPaul S. Vickery17-Feb-03 5:18 
GeneralIcon background color problem. PinmemberIlushka13-Nov-02 23:21 
QuestionAre 256 color icons possible? Pinmemberclintsinger7-Aug-02 13:52 
Generalmap the message PinsussAnonymous30-Jul-02 21:35 
GeneralAddding Button to Standard OutLook Toolbar Pinmemberajith7-Apr-02 21:59 
GeneralReceiving and Sending email or Creating/Viewing tasks PinmemberAnonymous8-Nov-01 9:56 
GeneralAnotjher minor drawing detail PinmemberAnonymous3-Jul-01 3:28 
GeneralRe: Anotjher minor drawing detail PinmemberRashid Thadha3-Jul-01 12:54 
GeneralMinor drawing detail PinmemberAnonymous3-Jul-01 3:20 
GeneralRe: Minor drawing detail PinmemberRashid Thadha3-Jul-01 12:54 
Generalcompiled error PinmemberAnonymous26-Jun-01 21:41 
GeneralRe: compiled error PinmemberRashid Thadha27-Jun-01 4:18 
Generalwont compile. PinmemberAnonymous8-May-01 14:37 
GeneralRe: wont compile. PinmemberRashid Thadha8-May-01 23:55 
Generala bug... Pinmemberdevhead015-May-01 10:55 
GeneralRe: a bug... PinmemberDerek Strasen10-May-01 7:29 
GeneralRe: a bug... Pinmemberkiwi27-Aug-01 20:14 
GeneralRe: a bug... Pinmemberdududu17-May-04 20:47 
GeneralHorizontal Splitters PinmemberAnonymous25-Mar-01 5:09 
GeneralRe: Horizontal Splitters PinmemberRashid Thadha15-Apr-01 9:15 
GeneralRe: Horizontal Splitters PinmemberOderon30-Jun-01 11:21 
This is really great work with that control. Big Grin | :-D
But I wondering why you have implemented your own splitter Confused | :confused:
You can use WTL implementation of splitter in such way:
//COutlookSplitterWindow m_splitter;
//COutlookHorSplitterWindow m_PaneSplitter;
CSplitterWindow m_splitter;
CHorSplitterWindow m_PaneSplitter;
//CHorSplitterWindow m_HorizontalSplitter;
//COutlookSplitterWindow m_VerticalSplitter;
CHorSplitterWindow m_HorizontalSplitter;
CSplitterWindow m_VerticalSplitter;
P.S. sorry for poor english:(
GeneralRe: Horizontal Splitters PinmemberRashid Thadha1-Jul-01 12:35 

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
Web03 | 2.8.150326.1 | Last Updated 28 Jun 2001
Article Copyright 2001 by Rashid Thadha
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid