SAMPLE: Blink.exe Demonstrates How to Use Blinking Text

ID: Q11787


The information in this article applies to:


SUMMARY

It is possible to create blinking text in a Windows-based application. Because there are no character attributes similar to the normal MS-DOS text environment, the application must repeatedly paint the screen to implement the flash. Blink.exe is a sample file that demonstrates how to do this.


MORE INFORMATION

The following file is available for download from the Microsoft Software Library:

~ Blink.exe
For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base:
Q119591 : How to Obtain Microsoft Support Files from Online Services


A timer is used to determine the rate at which the text flashes. Timer messages are processed by inverting the appropriate area in the window using the DSTINVERT action of the PatBlt function. The second time that the PatBlt function is called, the text returns to its original state. Alternatively, the PATINVERT action of the PatBlt function may be used. To use this method, an appropriate brush must be selected into the display context as the current pattern. This method requires more work, however, it is more flexible.

The rate at which the text blinks can be set to match the cursor blink time set in the Control Panel. To do this, the following code should be run when the application starts and in response to WM_WININICHANGE messages:

   nRate = GetProfileInt(
     (LPSTR)"windows",         /* heading in [] */ 
     (LPSTR)"CursorBlinkRate", /* string to match */ 
      550);                    /* default value */  

Be sure to delete the timer when the application terminates.

Blink.exe uses this technique to demonstrate blinking text.


Keywords          : kbfile kbsample kbNTOS kbGrpUser kbWinOS kbWndw kbWndwMsg 
Version           : 
Platform          : 
Issue type        : 

Last Reviewed: March 4, 1999