T
T
twobomb2016-03-20 18:35:38
Programming
twobomb, 2016-03-20 18:35:38

C# how to hang a mousemove event on the screen?

I create a drag & drop of the entire window, you can drag for a certain area.
The problem is that you need to hang the mouse movement event on the screen, that is, so that the listener is called even when I move the cursor outside the program window. I can only hang on a window or its elements, but I didn’t find how to do this.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
AxisPod, 2016-03-24
@twobomb

Dig towards Mouse Capture and don't listen to all sorts of hooks. This mechanism will allow you to catch mouse events even if the mouse is not in the focus of your window.
For example https://msdn.microsoft.com/en-us/library/ms171545(...

A
Alexander Ananiev, 2016-03-20
@SaNNy32

You need to use the global mouse hook via SetWindowsHookEx https://msdn.microsoft.com/en-us/library/ms644990(...

T
Tsiren Naimanov, 2016-03-20
@ImmortalCAT

WIN API google

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question