Windows mouse locking doesn't work

ignas2526

Bit poster
Hello,
I'm working on a OpenGL application and I'm having difficulties with changing mouse position(mouse locking).
Application is not in the fullscreen mode, when SmartMouse is On or on Auto it doesn't let me lock the mouse, if I turn SmartMosue Off it works as expected.
I'm using SetCursorPos function, here's C code:
POINT Mpt;
Mpt.x = 200; Mpt.y = 200;
ClientToScreen(hWnd, &Mpt);
SetCursorPos(Mpt.x, Mpt.y);
Is there any way to lock position of the mouse when SmartMouse is on?
Thanks.
 
Last edited:
When Smart Mouse is On or Auto, mouse cursor is controlled by host mouse only.
When Smart Mouse is set to Auto and cursor is hidden, mouse is effectively locked it in VM. But you'll have to draw cursor in your program' window somehow.
When Smart Mouse is off, mouse cursor is fully controlled by VM.
 
Thanks, it worked!
In case someone has similar problem, call this function once: ShowCursor(0); somewhere before SetCursorPos.
 
Back
Top