Answer the question
In order to leave comments, you need to log in
How to capture cursor similar to vmware or remote desktop? Windows c\c++\c#
Hello.
It is necessary to write a window application in Windows that captures the cursor. And I want it to be like in shooters, where you can endlessly move the mouse to the left or right without being afraid to rest against the end of the window / screen.
How is it done correctly? I don't want to make a bike.
Thanks
Answer the question
In order to leave comments, you need to log in
Mouse capture - HWND SetCapture(HWND hWnd); Release - BOOL ReleaseCapture(VOID); Perhaps HWND GetCapture(VOID); and a WM_CAPTURECHANGED message.
Well, firstly, inside the window of the virtual machine (guest), the cursor is its own, when the cursor is captured by the virtual machine, its position is remembered and it is hidden, while the coordinates of the cursor are thrown into the virtual machine, but taking into account the position of the window, if the real one went beyond the border, then the coordinate in the virtual machine will be internal and it is regulated by the virtual machine itself (since a hard mouse is emulated).
If it is impossible to release the cursor, then there are methods that limit mouse movements, I remember, I will write.
First, to capture the mouse (capture mouse), so that when the window goes outside the mouse events do not go to other applications.
Secondly, "return" the cursor if it exited.
track the cursor coordinate and if it goes beyond a certain interval, return it back
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question