Click here to Skip to main content
11,934,783 members (51,059 online)
Click here to Skip to main content
Add your own
alternative version


36 bookmarked

Using Hot Toolbar Buttons

, 15 Dec 1999
Rate this:
Please Sign up or sign in to vote.
Demonstrates how to add rollover buttons to your toolbar
  • Download demo project - 30 Kb
  • Sample Image - toolbar_hotbuttons.gif

    <!-- Article Starts -->

    If you wanted to add hot toolbar buttons like the ones seen in internet explorer, it is pretty straight forward. This approach for will work for both Visual C++ 5 and 6, however you may want to read up on the enhancements to the toolbar class for VC 6.0.

    After your toolbar has been created in CMainFrame::OnCreate(), you will need to add the following code, this is assuming that you have two bitmap resources already created IDB_TOOLBAR_COLD for normal, and IDB_TOOLBAR_HOT for hot buttons:

    // Set up hot bar image lists.
    CImageList imageList;
    CBitmap    bitmap;
    // Create and set the normal toolbar image list.
    imageList.Create(21, 20, ILC_COLORDDB|ILC_MASK, 13, 1);
    imageList.Add(&bitmap, RGB(255,0,255));
    m_hotToolBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList);
    // Create and set the hot toolbar image list.
    imageList.Create(21, 20, ILC_COLORDDB|ILC_MASK, 13, 1);
    imageList.Add(&bitmap, RGB(255,0,255));
    m_hotToolBar.SendMessage(TB_SETHOTIMAGELIST, 0, (LPARAM)imageList.m_hImageList);

    The send message portion of the code has been wrapped into a CToolBarCtrl() function call for Visual C++ 6. If you will notice, I have used 24 bit color images with the toolbar shown here, so you are not limited to just 16 colors.


    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

    Kirk Stowell
    CEO Codejock Software
    United States United States
    No Biography provided

    You may also be interested in...

    Comments and Discussions

    GeneralGreat stuff - and here is the Disabled flag Pin
    Mark Grieve15-Mar-00 18:27
    sussMark Grieve15-Mar-00 18:27 

    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.151126.1 | Last Updated 16 Dec 1999
    Article Copyright 1999 by Kirk Stowell
    Everything else Copyright © CodeProject, 1999-2015
    Layout: fixed | fluid