:)
I know I can get the position of the mouse cursor when it is hovering/moving over the active form however how can I capture the mouse even when the mouse pointer/cursor is off the form?
is this possible?
Printable View
:)
I know I can get the position of the mouse cursor when it is hovering/moving over the active form however how can I capture the mouse even when the mouse pointer/cursor is off the form?
is this possible?
The Cursor class has the static member "Position" which is a Point.
so, something like this:
hope this helps!Code:Using System.Windows.Forms;
// ....
MessageBox.Show("Cursor is at (" + Cursor.Position.X.ToString() + "," + Cursor.Position.Y.ToString() + ").");
oh I already had that. Actually I meant, how can I get feedback all the time? in other words, some how catching the mouse move event even if its off the form?
I found another NOT so good solution - stick a timer on the label and on every millisecond get the cursor position and that works.
Use a mouse hook.
explain a bit more please - in depth.
Register a mouse hook for a window and that window will receive system-wide mouse messages in its window message loop (WndProc). Override the standard WndProc method to receive the messages.
If you do a quick Google, like this, you will find examples of that.