Scrolling Credits in your About Box

by Tony Harris - Jenton Software

To begin we will use the SendMessage API call to cause a multiline textbox to scroll programmatically. So that it looks cool, we will dispense with scroll bars, adding a timer to control the scroll speed and when it starts.

To place the text in a continuous loop, preload whatever credits you want into a string array, so the last line is displayed, we can then take the first line of the text and add that first line to the end of the text. And to prevent running out of memory or string space, take then continue to do this dynamically to create the continuous scroll.

The heart of the matter comes from Microsoft KnowlegeBase Article ID Q73371, in which is described the use of the SendMessage API using the constant EM_LINESCROLL. You can invoke the SendMessage function in this way;

  r& = SendMessage& (hWd%, EM_LINESCROLL,  wParam%, lParam%)

lParam% is actually made of 4 bytes; the low-order 2 bytes control the number of vertical lines to scroll, while the high order 2 bytes specify the number of horizontal columns to scroll. Positive numbers scroll up and to the left; and negative numbers do the opposite. Getting a handle on a control means you must first set the focus on that control.

The program flow is:

Demonstrative code for continuously scrolling credits in your about box.

Written by: Tony Harris
Oct 95