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

The Spring Computing Windows Controls

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

Introduction

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

Credits

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.

License

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

Share

About the Author

Maxime Labelle
Web Developer
France France
Coming soon...

Comments and Discussions

 
GeneralGetting compiler errors. PinmemberWREY25-Aug-05 2:42 
GeneralRockin! PinmemberMarc Brooks9-Oct-01 16:34 
GeneralRe: Rockin! PinmemberMaxime Labelle9-Oct-01 21:42 
GeneralRe: Rockin! PinmemberMarc Brooks10-Oct-01 7:28 
GeneralMy God, this is FABULOUS. Pinmembertim tabor1-Oct-01 13:34 
QuestionDetails? PinmemberPaul A. Howes28-Sep-01 2:26 
AnswerRe: Details? PinmemberMaxime Labelle30-Sep-01 21:24 
GeneralRe: Details? PinmemberAnonymous1-Oct-01 3:31 
GeneralRe: Details? PinmemberIvan Ilinov1-Oct-01 20:32 

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 | Mobile
Web02 | 2.8.140821.2 | Last Updated 28 Sep 2001
Article Copyright 2001 by Maxime Labelle
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid