Microsoft KB Archive/68882

Programming the Mouse in Unsupported Display Modes PSS ID Number: Q68882 Article last modified on 05-12-1993 PSS database name: H_Mouse

6.x 7.x 8.x 9.0

MS-DOS

Summary:

When programming the mouse in unsupported display modes, the mouse cursor must be drawn and maintained by the programmer through direct video-memory programming.

More Information:

The following is an outline of the steps necessary to create and maintain a mouse cursor in a video mode that is not supported by the mouse driver. This is intended as a general guide only.

main {

set the video mode;

call mouse function 0 to reset the mouse;

call mouse function 4 and set the mouse position to (0,0); /* This is necessary so that a known starting point can be used to keep track of the mouse cursor position. The screen coordinates that are reported by the mouse driver cannot be used. Monitor the last known position and Delta X and Delta Y (mouse     function 11) movement to calculate the new mouse position. */

call mouse functions 7 and 8 to define the new boundaries for the mouse;

call mouse function 20; /* The subroutine that is called, OurCursor in this example, will maintain the new mouse cursor. */

do { main body of program; } while (the program is not done.);

reset the video mode to default setting;

call mouse function 0 to reset the mouse; }

void OurCursor /* OurCursor MUST be written in assembler */ { get Delta X;

get Delta Y;

calculate new cursor position;

restore the screen where cursor was;

save the screen area where the cursor will be;

draw the cursor on the screen;

save the new Y cursor coordinate;

save the new X cursor coordinate; }

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

Copyright Microsoft Corporation 1993.