k2000 wrote:
how can I determine where the mouse is??? ???
In my case (wireless mouse) it's kicking a random pile of junk and then seeing whether my mouse pointer moved. If so, it's in the pile, if not, it wasn't. Determining whether it's on the desk is giving the desk a shove to see whether the computer wakes up.
Practically, I can see two points. Where should I look for a mouse (in the OS, finding an object to call a "mouse"), and where should I place / move the mouse pointer.
The answer to the first is to try to command a mouse on any random port where a mouse could be, and if you don't get an answer, assume it isn't there. These ports include all serial ports you can find / think of, and the PS2 port obviously. Search the web for docs on them. If you can do USB detection, look for a mouse in your results and if there's one, use it.
Where to place the mouse pointer is the location where it was, plus where it moved. All mice send you movement data, because they just can't find any other data since they don't know what you'd want to do with it. Same with a keyboard, but that's kind of off-topic. You can scale, invert, transpose, do anything with the mouse data to make it do what you want.
A more complex issue is, how can I detect what a user wants to use as a mouse. For that, allow him to connect any directional movement indicators as mouse direction indicators, and any buttons as mouse buttons. You can also accept buttons as direction indicators. This allows anybody to set their preferences as they'd like, and you can define any number of virtual mice using buttons, keys, or for instance three keyboards a joypad two joysticks and three real mice. You can also let them devise multiple virtual desktops, where they define a desktop of their own based on a virtual mouse, a virtual keyboard and a virtual display location, plus additional virtual devices you like to give them. That makes it very straightforward to make everybody at home, and to allow people to connect more than one mouse. It also allows for "cheap solutions" for people without cash, to use a computer with two monitors, two mice and two keyboards as if it were two computers. Of course, you can allow other things, such as two users working on one desktop, although I now already envision sisters stealing their brothers document windows
HTH, Candy