INF: Creating a Nonblinking Caret

ID Number: Q74607

3.00

WINDOWS

Summary:

The Microsoft Windows graphical environment is designed to provide a

blinking caret. However, using a timer and the SetCaretBlinkTime

function, an application can "trick" the caret into not blinking.

More Information:

Although Windows is designed to blink the caret at a specified

interval, a timer function and SetCaretBlinkTime can be used to

prevent Windows from turning the caret off by following these three

steps:

1. Call SetCaretBlinkTime(10000), which instructs Windows to blink the

caret every 10,000 milliseconds (10 seconds). This results in a

"round-trip" time of 20 seconds to go from OFF to ON and back to

OFF (or vice versa).

2. Create a timer, using SetTimer, specifying a timer procedure and a

5,000 millisecond interval between timer ticks.

3. In the timer procedure, call SetCaretBlinkTime(10000). This resets

the timer in Windows that controls the caret blink.

When an application implements this procedure, Windows never removes

the caret from the screen, and the caret does not blink.

Additional reference words: 3.00