I wrote a few tools plugins for Illustrator. http://perso.orange.fr/jlg.outils
To make a new tool added to the Illustrator toolbox, you have to use the AIToolMessage structure.
In this structure, you find the mouse coordinates. Look into AITool.h.
This structure is used by toolMouseDown, toolMouseDrag, toolTrackCursor, toolSelect, toolMouseUp, toolDeselect.
//When your tool is selected and
//each time, your mouse moves, myPos contain your mouse position.
myPos.h=message->cursor.h;
myPos.v=message->cursor.v;
...
}
This is a tricky one. If you've written a tool plugin, then you can receive events about mouse clicks & drags, but only if you tool is selected. If you want to receive this information at any given time, the answer is "you can't"...at least not with the API.
It is possible to use the OS to catch mouse movement and clicks, though you'll have to catch the document opened notifier and hook into the right window to get the events. This is fairly straight forward to do with Spy++ on Windows (not sure what the equivalent on Mac is) in order to figure out what the window structure is, at least until CS3. After that, CS4 is a mess to figure out -- there are so many permutations of window organizations because you can have tabbed or not-tabbed or floating-tabbed documents. We actually hook into to this kind of functionality through the OS to get mouse movements and while it does work (and not terribly hard), we haven't got it 100% on CS4.