|
-
Aug 19th, 2006, 03:16 PM
#1
Thread Starter
PowerPoster
catch mouse!

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?
-
Aug 19th, 2006, 03:33 PM
#2
Re: catch mouse!
The Cursor class has the static member "Position" which is a Point.
so, something like this:
Code:
Using System.Windows.Forms;
// ....
MessageBox.Show("Cursor is at (" + Cursor.Position.X.ToString() + "," + Cursor.Position.Y.ToString() + ").");
hope this helps!
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
Aug 19th, 2006, 04:46 PM
#3
Thread Starter
PowerPoster
Re: catch mouse!
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.
-
Aug 19th, 2006, 10:54 PM
#4
-
Aug 19th, 2006, 11:23 PM
#5
Thread Starter
PowerPoster
Re: catch mouse!
explain a bit more please - in depth.
-
Aug 20th, 2006, 07:05 AM
#6
Re: catch mouse!
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|