Stealing the Mouse
-
I have a need to grab the mouse and move it to specific locations in a target window, approximately once a second. Each time I grab the mouse, I save it's current position and put it back when i am done. However, I do not want to grab the mouse if the User is currently using it (like when pressing the left button for a drag) in some OTHER application as that causes undesirable effects and is a MAJOR irritation to the User. I think I need to get information about the mouse buttons that is system-wide in scope (not form-specific nor thread-specific). I hope that makes sense. Any ideas? Thanks.
-
I have a need to grab the mouse and move it to specific locations in a target window, approximately once a second. Each time I grab the mouse, I save it's current position and put it back when i am done. However, I do not want to grab the mouse if the User is currently using it (like when pressing the left button for a drag) in some OTHER application as that causes undesirable effects and is a MAJOR irritation to the User. I think I need to get information about the mouse buttons that is system-wide in scope (not form-specific nor thread-specific). I hope that makes sense. Any ideas? Thanks.
You might use the MouseEnter and MouseLeave events to keep track of the presence/absence of the mouse in your application. Remark: some special care may be required when you also use menus, since clicking them seems to interact with the normal Enter/Leave sequences. :)
Luc Pattyn
-
You might use the MouseEnter and MouseLeave events to keep track of the presence/absence of the mouse in your application. Remark: some special care may be required when you also use menus, since clicking them seems to interact with the normal Enter/Leave sequences. :)
Luc Pattyn
thanks for response ... but that does not help ... i need to know when the mouse is IN USE, not when it has left MY form.
-
thanks for response ... but that does not help ... i need to know when the mouse is IN USE, not when it has left MY form.
OK :cool: , sounds much like activity detection; this is used e.g. by screen savers, so I suggest you look at one of the many screen savers on CodeProject. Furthermore, you could look at a "global system hook" (as explained in http://www.codeproject.com/csharp/globalsystemhook.asp[^]).
Luc Pattyn
-
OK :cool: , sounds much like activity detection; this is used e.g. by screen savers, so I suggest you look at one of the many screen savers on CodeProject. Furthermore, you could look at a "global system hook" (as explained in http://www.codeproject.com/csharp/globalsystemhook.asp[^]).
Luc Pattyn
thank you, luc ... will do