S
S
sadgb2012-10-07 09:58:04
C++ / C#
sadgb, 2012-10-07 09:58:04

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

5 answer(s)
V
vScherba, 2012-10-07
@sadgb

Mouse capture - HWND SetCapture(HWND hWnd); Release - BOOL ReleaseCapture(VOID); Perhaps HWND GetCapture(VOID); and a WM_CAPTURECHANGED message.

A
AxisPod, 2012-10-08
@AxisPod

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.

N
Nikita Zimin, 2012-10-07
@nzeemin

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.

I
Ivan Arxont, 2012-10-07
@arxont

track the cursor coordinate and if it goes beyond a certain interval, return it back

S
sadgb, 2012-10-07
@sadgb

and please tell me what winapi functions will help me, I don’t know where to start

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question