probably not what you need, but there are lots of references to the API for restricting the mouse to areas on the screen.
search this site.....