Question

I am writing an OpenGL/DX application in which I read WM_INPUT messages in WndProc() to move a custom mouse cursor. The system mouse cursor is hidden via ShowCursor(false) when it is over/in the application's window.

The problem is that the system mouse cursor still moves when I move the mouse. So both cursors (the normal system cursor and the custom cursor in my application) are moving at the same time. The same goes for mouse clicks too.

So my question is: how can I prevent the system mouse cursor to move (and click) when the application is running, so that only the custom mouse cursor is functional?

Was it helpful?

Solution

The cursor is just for display. Hiding the default cursor and drawing your own one won't affect the move and click.

I guess there are two possibilities what you are doing:

  1. If you just want to display a custom cursor, you should just hide the system cursor when the mouse is inside your window. So the user knows what he/she is doing when the cursor is outside your window. Or you can constrain the mouse inside your window with ClipMouse.

  2. If you are handling the mouse completely by yourself with something like DirectInput, again, you should use ClipMouse.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top