Article View: comp.sys.mac
Article #12533Re: Help! Anyone know how to force the mouse to a location?
From: alistair
Date: Thu, 07 Jun 1990 13:13
Date: Thu, 07 Jun 1990 13:13
51 lines
2745 bytes
2745 bytes
In article <16995@phoenix.Princeton.EDU> bskendig@phoenix.Princeton.EDU (Brian Kendig) writes:
>In article <1990Jun5.091419.14219@portia.Stanford.EDU> canuck@portia.Stanford.EDU (William Stocker) writes:
>>I'm writing a Mac program in THINK Pascal 3.0, and need to force the
>>mouse to a particular screen location. I'm sure it's against Apple's
>>guidelines (there's no SetMouse command I can find in Inside Mac I-V),
>>but there's a good purpose for it -- trust me!
I'm sure you have a good reason - so here is some code to do it.
It's not original - I adapted it from some source someone else
previously posted on the net
procedure SetCursor (where: point);
const
{ some dangerous low-memory-global equates }
MBState = $172; { byte }
MTemp = $828; { Low Level interrupt mouse location (point) }
RawMouse = $82c; { unprocessed mouse location (point) }
Mouse = $830; { processed mouse location (point) }
CrsrNew = $8ce; { set <> 0 if mouse has moved (byte) }
CrsrCouple = $8cf; { set = 0 if cursor not allowed to move (byte) }
Couple = $ff; { value for CrsrCouple }
Uncouple = $00; { value for CrsrCouple }
var
LowGlob: integer;
LowMem: ptr;
PointPtr: ^point;
finalTicks: longint;
begin
LocalToGlobal(where); { Get ready to restore old mouse position }
LowMem := pointer(RawMouse); { point to low memory }
PointPtr := @LowMem^; { treat it as a point }
PointPtr^ := where; { store saved mouse position into it }
LowMem := pointer(MTemp); { point to low memory }
PointPtr := @LowMem^; { treat it as a point }
PointPtr^ := where; { store saved mouse position into it }
LowMem := pointer(CrsrNew);
LowMem^ := $ffff; { both CrsrNew & CrsrCouple }
Delay(5, finalTicks) { let the cursor catch up }
end; { SetCursor }
------------------------------------------------------------------
Alistair Edwards
University of York, York, England YO1 5DD
earn/bitnet: alistair@minster.york.ac.uk
arpanet: alistair@minster.york.ac.uk
internet: alistair%minster.york.ac.uk@nsfnet-relay.ac.uk
usenet: ukc!minster!alistair
Technical Details
Message-ID:
<644764405.19484@minster.york.ac.uk>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!mcsun!ukc!reading!minster!alistairReferences:
<1990Jun5.091419.14219@portia.Stanford.EDU> <16995@phoenix.Princeton.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!mcsun!ukc!reading!minster!alistair From: alistair@minster.york.ac.uk Newsgroups: comp.sys.mac Subject: Re: Help! Anyone know how to force the mouse to a location? Message-ID: <644764405.19484@minster.york.ac.uk> Date: 7 Jun 90 13:13:25 GMT References: <1990Jun5.091419.14219@portia.Stanford.EDU> <16995@phoenix.Princeton.EDU> Reply-To: alistair@SoftEng.UUCP (alistair) Organization: Department of Computer Science, University of York, England Lines: 51