July 24, 1998

Play WAV Sounds from Resource Files

Everyone loves a good sound bite. You can use the PlaySound() function in the Windows Multimedia DLL (WINMM.DLL) to play a wave (WAV) file that is stored as a resource.

Display Tooltips

You can easily duplicate the tooltips that appear when you float the mouse over a button in Microsoft’s products. This code displays the tooltip in the lower right-hand corner of

Random Values Without Duplicates

This code produces a “random” sequence of integers between specified Lower and Upper values without duplication. On the first call to the Shuffle routine with new values for Upper and

Change Display Settings on the Fly

When writing a game for Windows 95, set the display resolution to 640-by-480, set the color palette to True Color when it runs, and restore it to its initial mode

Comment Multiple Lines

VB provides only single-line comment functions: “REM” and “‘”. If you’re looking for another way to comment out a block of code, use conditional compilation in VB4 instead. Define “COMMENT

Write Less CPU-Bound Animations

When doing animation, such as scrolling a label or using picture boxes, I first used the method described by Eric Bernatchez (“Smoother Control Animation,” “101 Tech Tips for VB Developers,”

Use Subscripts and Superscripts

You can use subscripts and superscripts in a RichTextBox control. To prevent the control from truncating text that is raised or lowered too far, reduce the characters’ size accordingly: Private

Export Data to ISAM Databases

Use this code to get data out to different formats without requiring a complete copy of the DBMS on the user machine. Create a new project with a command button,

Highlight Text Automatically

When the focus of a graphical user interface shifts to an empty TextField, you type the desired input and step to the next one. But if the TextField is not