Microsoft KB Archive/70156

Graphics Mouse Cursor Color Cannot Be Changed PSS ID Number: Q70156 Article last modified on 05-13-1993 PSS database name: H_Mouse

6.x 7.x 8.x 9.00

MS-DOS

Summary:

The Microsoft Mouse graphics cursor cannot be changed to a different color. You can, however, change the shape of the cursor by using mouse function 9 of the Microsoft Mouse driver.

Note: The only way to change the color is to redefine the color palette, setting white to another color. Although this method changes the color, Microsoft strongly recommends that you do not do this. If your particular video display has hardware cursor support, the white hardware cursor is displayed instead of the remapped “white” color.

More Information:

The program below demonstrates the usage of mouse function 9. The program redefines the mouse graphics cursor to be an inverted arrow, and resets the hot spot to the tip of the new arrow.


 * 1) include  #include  #include  #include 

union REGS iregs, oregs; struct SREGS segregs;

static int reverse_cursor[] = { /* Define the new cursor / / Elements 0 - 15 define the screen mask */

0xfc7f, /* 1111110001111111 */ 0xfc3f, /* 1111110000111111 */ 0xfc3f, /* 1111110000111111 */ 0xfe19, /* 1111111000011001 */ 0xfe11, /* 1111111000010001 */ 0xff01, /* 1111111100000001 */ 0xfe01, /* 1111111000000001 */ 0xf001, /* 1111000000000001 */ 0xf801, /* 1111100000000001 */ 0xfc01, /* 1111110000000001 */ 0xfd01, /* 1111110100000001 */ 0xff81, /* 1111111110000001 */ 0xffc1, /* 1111111111000001 */ 0xffe1, /* 1111111111100001 */ 0xfff1, /* 1111111111110001 */ 0xfff9, /* 1111111111111001 */ /* Elements 16 - 31 define the cursor mask */

0x0000, /* 0000000000000000 */ 0x0180, /* 0000000110000000 */ 0x0180, /* 0000000110000000 */ 0x00c0, /* 0000000011000000 */ 0x00c4, /* 0000000011000100 */ 0x006c, /* 0000000001101100 */ 0x007c, /* 0000000001111100 */ 0x03fc, /* 0000001111111100 */ 0x01fc, /* 0000000111111100 */ 0x00fc, /* 0000000011111100 */ 0x007c, /* 0000000001111100 */ 0x003c, /* 0000000000111100 */ 0x001c, /* 0000000000011100 */ 0x0004, /* 0000000000000100 */ 0x0000, /* 0000000000000000 */ };

main { _setvideomode(_MAXRESMODE); /* Set video mode to graphics */

iregs.x.ax = 0; int86(0x33, &iregs, &oregs); /* Initialize the mouse       */

iregs.x.ax = 9;        /* Mouse Function 9                 */ iregs.x.bx = 15;       /* Horizontal hot spot coordinate   */ iregs.x.cx = 15;       /* Vertical hot spot coordinate     */ iregs.x.dx = (int)reverse_cursor; /* Offset of array       */ segread(&segregs); segregs.es = segregs.ds;    /* Segment of array            */ int86x(0x33, &iregs, &oregs, &segregs); /* Redefine the cursor */

iregs.x.ax = 1; int86(0x33, &iregs, &oregs); /* Show the mouse cursor      */

getch;                    /* Wait until a key is pressed */

_setvideomode(_DEFAULTMODE); /* Restore video mode         */

iregs.x.ax = 0; int86(0x33, &iregs, &oregs); /* Reset mouse and hide cursor */ }

Additional reference words: 6.00 7.00 7.03 7.04 7.05 8.00 8.10 8.20 9.00 programming

Copyright Microsoft Corporation 1993.