Text Cursors

To set a new text cursor, VMOUSE calls the cursor VxD's SETTEXTCURSOR function, passing the address of a TEXTCURSOR structure. The cursor VxD sets a new text cursor based on the information in the structure.

The bFlags member of TEXTCURSOR indicates whether the new cursor is a hardware or software text cursor. If bFlags is 1, the new cursor is a hardware text cursor, and the XORMask and ANDMask members specify the first and last scan lines of the cursor. The VxD draws the cursor by directing the display adapter to turn on the specified scan lines in the character cell that contains the cursor. A scan line that is turned on typically appears as a bar in the character cell.

If the bFlags member of TEXTCURSOR is 0, the new cursor is a software text cursor. In this case, the XORMask and ANDMask members specify the cursor mask and screen mask, respectively. The cursor and screen masks are bitmasks that define how the cursor affects the character and attributes of the character cell it occupies. The screen mask is a 16-bit value that determines which of the character cell's attributes are preserved; the cursor mask is a 16-bit value that determines how the preserved attributes change to yield the cursor.

To draw the cursor, the VxD operates on the screen data that defines the attributes of the character cell occupied by the cursor. The screen data for a character cell has the following format.

Bits Purpose
15 Sets blinking or nonblinking character
12 – 14 Sets background color
11 Sets intensity
8 – 10 Sets foreground color
0 – 7 Specifies ASCII value of character

The VxD first does a logical AND operation between the screen mask and the screen data for the character cell. Next, it does a logical XOR operation between the cursor mask and the result of the AND operation, producing the cursor's appearance on the display.

See also SETTEXTCURSOR, TEXTCURSOR