Click here to Skip to main content
13,596,190 members
Click here to Skip to main content
Add your own
alternative version


32 bookmarked
Posted 27 Sep 2001

The Spring Computing Windows Controls

, 27 Sep 2001
Rate this:
Please Sign up or sign in to vote.
A set of Win32 Windows controls.


Being mostly curious, I was recently very interested in knowing more about Windows controls. After gathering various documentations and help from fellow developers in the ATL Mailing List, I decided to have a go.

The result of my tribulations was originally published in my now defunct article about a CaptionBar Windows Control, here at CodeProject. This article supersedes and enhances what was said at the time.

This article presents raw Win32 controls, as opposed to ActiveX controls. I'm providing wrapper classes for use in your WTL applications, and I expect people interested in these controls to provide MFC wrapper classes in the future.

I wrote these controls to satisfy my curiosity about Windows development in general, and because I felt there is space for UI improvement in the WTL arena. This control will come alongside others here at CodeProject to fill the gap.

Currently, version 1.2 of the springctrls.dll implements the following Windows controls:

How to use these controls

To use these controls, you need to include the springctrls.h header file and link your application with the springctl32.lib import library. The controls themselves are implemented in the springctl32.dll dynamic link library.

Before using any function involving the Windows controls, an application needs to register the various window classes using the ::InitWindowsControls() function. This function doesn't take any argument, and returns nonzero if it succeeds or zero otherwise.

The Win32 way

A Windows control is no more than a customized window, that respond to a specific set of messages. An application typically deal with a Windows control by using a bunch of ::SendMessage() calls to perform specific tasks.

Before an application can interact with a Windows control, the control window class must be registered, as described at the beginning of this section, and the control itself must be created using the ::CreateWindowEx() API.

The WTL way

The code accompanying this article provides a set of wrapper classes, for use in your WTL applications. Using these wrappers is significantly easier than explicitly creating and sending appropriate messages to the controls.

The atlspctl.h header file contains the definitions of the Windows controls themselves. You can use methods of the CShortcutCtrl and CCaptionBarCtrl classes as you would with any other common control wrapper classes provided in WTL.

The CaptionBar control needs more care for proper use. Like the standard ToolBar, StatusBar and ReBar common controls, a CaptionBar control positions itself at the top of its parent window's client area. Therefore, an application must manage the position and size of child windows in the remaining space. The atlspctlw.h header file provides an additional CCaptionBarWindowImpl template to help you use this control efficiently.

The Spring Computing Windows controls

The Shortcut control

Shortcut controls act as containers for child windows. An application assigns child windows, which are often other controls, to a shortcut control pane. Shortcut controls contain one or more panes, and each pane can have a text label and a child window. Shortcut control panes cannot contain more than one child window.

A shortcut control has one pane currently displayed at any one time. As different panes are selected, the shortcut control manages the size and position of their child windows.

The following illustration shows a shortcut control with three panes:

CaptionBar Control

The CaptionBar control

CaptionBar controls are horizontal windows that position themselves at the top of a parent window's client area. A caption bar can display a combination of text and bitmap.

A caption bar control's caption text can be created as either being static, push button or toggle button.

The following animation shows a caption bar control that switches between static and toggle button mode, with an icon aligned on the right.

CaptionBar Control


Although these controls were written from scratch, I have used information and sample code from various sources to help me.

This control greatly benefits from Tim Tabor's wonderful help. Tim is living on the outskirts of the ATL Mailing List and the WTL Mailing List, and was kind enough to answer some of my silly questions!

The Shortcut control was inspired by Christopher Brown's CWndSliderView as well as Rashid Thada's Outlook Bar Control and Frame.

I hope those controls will be useful. Certainly, writing them has been an exciting and wonderful challenge. I'm hoping to add more and more controls over time and welcome any suggestions. Of course, if you have written a piece of code that you would like to publish as Windows controls, we may turn this into a whole project, why not? And, please, feel free to give me any suggestions to enhance this article.


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

Maxime Labelle
Web Developer
France France
Coming soon...

You may also be interested in...


Comments and Discussions

GeneralGetting compiler errors. Pin
WREY25-Aug-05 2:42
memberWREY25-Aug-05 2:42 

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.

Permalink | Advertise | Privacy | Cookies | Terms of Use | Mobile
Web04 | 2.8.180621.3 | Last Updated 28 Sep 2001
Article Copyright 2001 by Maxime Labelle
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid