Microsoft KB Archive/70156: Difference between revisions

From BetaArchive Wiki
m (Text replacement - ">" to ">")
m (Text replacement - "&" to "&")
Line 65: Line 65:


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


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


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


     getch();                    /* Wait until a key is pressed */
     getch();                    /* Wait until a key is pressed */
Line 83: Line 83:


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



Revision as of 14:20, 21 July 2020

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

The information in this article applies to:
- Microsoft Mouse Driver for MS-DOS, versions 6.x, 7.x, 8.x, and 9.0

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 <graph.h> #include <stdio.h> #include <conio.h> #include <dos.h>

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.