Keeping the mouse inside the window

BlitzMax Forums/BlitzMax Programming/Keeping the mouse inside the window

So pursuant to my totally awesome game, I need a way to keep the mouse inside the game window, so you don't click outside and lose focus. I don't want to do the old movemouse width/2,height/2 trick because that's laggy and rubbish. I assume there's something in the winAPI that lets you get the screen position of the mouse, but I've got no experience with that sort of stuff at all. Any ideas?

Go fullscreen?

Here's how to get the mouse position relative to the screen.
Extern "win32"
	Function GetCursorPos(lpPoint:Byte Ptr)
End Extern

Type POINTAPI
	Field X, Y
End Type

p:POINTAPI = New POINTAPI
GetCursorPos p
Print p.X + ", " + p.Y
p = Null
FlushMem
End
SetCursorPos lets you move it.
http://www.blitzbasic.com/codearcs/codearcs.php?code=1186

Eikon, how do you know that? Where did this information
come from?

it comes from the winAPI :)

Eikon, how do you know that? Where did this information
come from?

http://www.mentalis.org/agnet/appdown.shtml

Thanks for that info, I played about with it for a bit and realised the mouse speed can always be greater than whatever buffering you put on the window borders to prevent the point leaving the window, so I've given up and used relative positioning, with the cursor locked to the middle of the window and made invisible.
Another solution I can think of would be to make an invisible window the size of the display placed on top of everything else to catch any mouse clicks, but I don't know how to do that so I'm not bothering :P