system.win32.c - bbMoveMouse fix

BlitzMax Forums/BlitzMax Module Tweaks/system.win32.c - bbMoveMouse fix

fredborg(Posted 2005) [#1]
Hi,

This fixes the problem with MoveMouse in windowed mode:
void bbMoveMouse( int x,int y ){
    POINT mpos;
    mpos.x = x;
    mpos.y = y;
    int n=ClientToScreen(GetActiveWindow(),&mpos);
    if (n!=0) SetCursorPos( mpos.x,mpos.y );
}
Unlike the Blitz2D/3D/+ one, this one only moves the mouse when the BMax window has focus.

And a small test to see that it works:
Graphics 640,480,0

While Not KeyHit(KEY_ESCAPE)
	Cls
	DrawRect 320-3,240-3,7,7
	MoveMouse 320,240
	Flip
Wend