Articles / TULARC / Macintosh Operating Systems / Mac Programming / | ||||
|
||||
3.2) How do I move the mouse cursor to a specific position? (User / Machine interaction - Mac Programming) |
||||
|
||
This article is from the Mac Programming FAQ, by Jon Watte h+@austin.metrowerks.com with numerous contributions by others.
Wait! Don't do it! There has to be a better way!
If you feel you HAVE to do it (for a game or VERY special simulation
situation) you can use the Cursor Device Manager documented in the tech
notes on <ftp.apple.com>. If that manager is not installed, as it's not
on older Macs, you can use the following code:
You need to have some low-memory globals defined. they may be defined
in SysEqu.h.
#define MTemp 0x828
#define RawMouse 0x82c
#define CrsrNewCouple 0x8ce
Note that CrsrNewCouple is actually a combination of two globals, just
to make our life slightly easier.
The code I use to move the mouse is:
*code* void MoveMouseTo ( Point where ) { HideCursor ( ) ; * ( Point * ) RawMouse = where ; * ( Point * ) MTemp = where ; * ( short * ) CrsrNewCouple = -1 ; ShowCursor ( ) ; } *end*
 
Continue to:
|