A Switcher Control (like the Windows Task Bar) | CodeGuru

A Switcher Control (like the Windows Task Bar)

Environment: VC6 SP2, WinNT 4.0 SP3, Win98 GOLD Ever since Windows 95 first came out, I have noticed that just about every developer was scambling to get all the new common controls and UI features into their applications… but it seems like nobody has yet to make a taskbar-like control. So I set out to […]

Written By
CodeGuru Staff
CodeGuru Staff
Mar 22, 1999
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Environment: VC6 SP2, WinNT 4.0 SP3, Win98 GOLD

Ever since Windows 95 first came out, I have noticed that just about every
developer was scambling to get all the new common controls and UI features into
their applications… but it seems like nobody has yet to make a taskbar-like
control. So I set out to make one.

After looking at how Microsoft made their task switcher control (they use a
modified Tab Control), I decided to just use MFC and subclass a CWnd to make mine.

It was actually pretty simple to make. I simply subclassed a CWnd for the
button – CSwitcherButton – and subclassed a window to manage the buttons –
CSwitcherWnd.

To use, download the source or demo below and add CSwitcherButton.cpp,
CSwitcherButton.h, CSwitcherWnd.cpp, and CSwitcherWnd.h to your project. Then,
include CSwitcherWnd.h and CSwitcherButton.h in your window or dialog (or whatever
file you want to use it in; it *must* be derived from CWnd, tho). An easy way to
include these files globally is to include them in stdafx.h or YourApp.h.

To implement, simply create a CSwitcherWnd object, and call DoCreate.

Example:

(m_wndSwitcher created in the .h file)

m_wndSwitcher.DoCreate(this, 0, 200);

Which will create a switcher at the top of the window with width 200.

That about covers it. Enjoy.

Updates MON MAR 15 1999 – JIMMY BRUSH:

  • Fixed RemoveButton to correctly decrement selected button
  • Added CMemDC by Keith Rule
  • Fixed up Animation a bit

Download demo project – 32 KB

Download source – 8 KB

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.