Title:
Windows Status Bar Control
Author:
Philip J. Erdelsky, http://www.efgh.com, pje@efgh.com
Language:
Turbo C/C++ 3.1 for Windows, Borland C++ Builder 1.0 for Windows 95
Platform:
Windows 3.1/95/NT
Portability:
Other Windows C++ compilers, with slight changes
Restrictions:
Public domain, no restrictions on use
Date:
November 13, 1997
Keywords:
Windows Custom Control, Status, Completion
Abstract:
A windows custom control for a simple status bar. C++ source code only; no VBX file.
Source code:
STATUS.CPP, STATTEST.CPP and STATTEST.RC combined into the file STATUS.TXT

The "STATUSBAR" control is a simple, common control that does not appear among the Windows standard controls. Its purpose is to show a simple message. It is a completely passive control which changes only in response to messages sent by its parent.

You can put a "STATUSBAR" control into a dialog box by including a line of the following form in the appropriate place in the resource (.RC) file:

     CONTROL 0, control_id, "STATUSBAR", WS_CHILD | WS_VISIBLE,
       x, y, width, height

You can also put a "STATUSBAR" control into a dialog box with the Borland Resource Workshop, by selecting a custom control and then entering the class name "STATUSBAR" instead of choosing one of the predefined classes.

You can also create a "STATUSBAR" control dynamically with an appropriate call on CreateWindow().

A "STATUSBAR" control processes the following messages in the standard manner:

A "STATUSBAR" control does not process other messages, except for a few that are handled internally by Windows.

Normally, a "STATUSBAR" control limits its text to 127 characters and includes a 5-pixel margin, but you can change these parameters in the source file STATUS.CPP. You can also change the text and background colors or other features of the control if you wish.

The file STATUS.CPP must be compiled and linked with the rest of the application.

The files STATTEST.CPP and STATTEST.RC contain a simple test program uses a "STATUSBAR" control.

It is fairly difficult to compile applications as simple as this test program with Borland C++ Builder for Windows. To prevent the automatic inclusion of irrelevant material, the compiler has to be called up by command lines executed in a DOS window, perhaps as follows:

REM Compile and Link Picture Button Test Application
SET BDIR=C:\PROGRA~1\BORLAND\CBUILDER
BCC32 -DWIN32 -I%BDIR%\INCLUDE -L%BDIR%\LIB -W stattest.cpp status.cpp
BRC32 -32 stattest
SET BDIR=