Title: Windows Marquee Control Author: Philip J. Erdelsky, 75746.3411@compuserve.com Language: Turbo C/C++ 3.1 for Windows Platform Windows 3.1 Portability: Other Windows C++ compilers, with slight changes Restrictions: Public domain, no restrictions on use Date: January 13, 1995 Keywords: Windows Custom Control, Static Abstract: A windows custom control which displays text in a border consisting of a circulating dashed line. The resulting display resembles a theater marquee. C++ source code only; no VBX file. The "MARQUEE" control is a simple control that you can use as a substitute for the standard Windows STATIC control. It displays text in a circulating dashed line. The resulting display resembles a theater marquee. You can put a "MARQUEE" control into a dialog box by including a line of the following form in the appropriate place in the resource (.RC) file: CONTROL initial_text, control_id, "MARQUEE", WS_CHILD | WS_VISIBLE, x, y, width, height You can also put a "MARQUEE" control into a dialog box with the Borland Resource Workshop, by selecting a custom control and then entering the class name "MARQUEE" instead of choosing one of the predefined classes. You can also create a "MARQUEE" control dynamically with an appropriate call on CreateWindow(). The control handles the following messages in the same manner as a standard STATIC control: WM_SETTEXT WM_GETTEXT WM_SETFONT WM_GETFONT You can change the speed with which the border circulates by sending the control a message of the following form: SendDlgItemMessage(handle, control_id, MA_SETSPEED, speed, 0L); Here "speed" is normally in the range from about -40 to about +40. Positive values make the border circulate clockwise; negative values make it circulate counterclockwise. The value 0 stops the circulation altogether. Values near the extremes may produce aliasing, in which the direction of circulation seems to be reversed. The default speed is 20. You can retrieve the speed by sending the control another message: speed = SendDlgItemMessage(handle, control_id, MA_GETSPEED, 0, 0L); Each "MARQUEE" control with a circulating border uses a system timer. The number of system timers is limited. Therefore, when a "MARQUEE" control is not being used, you should either destroy it or set its speed to zero. The control does not handle other messages, except for a few that are normally generated internally by Windows. It generates no notification messages. The file MARQUEE.CPP must be compiled and linked with the rest of the application. The special messages MA_SETSPEED and MA_GETSPEED are defined in the header file MARQUEE.H. The files MARQTEST.CPP, MARQTEST.H and MARQTEST.RC contain a simple test program uses a "MARQUEE" control.