Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!dg-rtp!dgcad!aeras!sun!stpeter.Eng.Sun.COM!cmcmanis From: cmcmanis@stpeter.Eng.Sun.COM (Chuck McManis) Newsgroups: comp.sys.amiga.tech Subject: Re: Finding current mouse status. Keywords: Mouse Message-ID: <143184@sun.Eng.Sun.COM> Date: 29 Sep 90 18:01:02 GMT References: <1990Sep18.192348.3594@cs.umn.edu> Sender: news@sun.Eng.Sun.COM Distribution: comp Organization: Sun Microsystems, Mt. View, Ca. Lines: 38 In article <1990Sep18.192348.3594@cs.umn.edu> (Russell Cattelan) writes: >I am tring to port the programs the was orginally written for and IBM >The program is not interupt driven, so when it wants to find out what the >mouse status is it just looks at it and updateds a global structure. A friendly way to do this is to create an input handler which simple tracks the mouse by looking at all of the mousemove events. It should open a public message port with some well known name like "MousePosition" and keep with the port two shorts which contain the mouse position. Since your code will only be reading the position you don't have to worry about multiple writers. So your code will look something like : main() ... struct custom_port { struct MsgPort port; USHORT MouseX; USHORT MouseY; } *mp; mp = FindPort("MousePosition"); if (mp == NULL) /* error can't find handler's port */ ... MouseX = mp->MouseX; MouseY = mp->MouseY; /* etc */ } You can kick off the input handler from your code or you can have a separate program to do that. In 2.0 you would build a commodity to do this fairly easily. -- --Chuck McManis Sun Microsystems uucp: {anywhere}!sun!cmcmanis BIX: Internet: cmcmanis@Eng.Sun.COM These opinions are my own and no one elses, but you knew that didn't you. "I tell you this parrot is bleeding deceased!"