all groups > c# > september 2003 >
You're in the

c#

group:

mouse move event


mouse move event Logan Mckinley
9/16/2003 11:10:26 PM
c#: I need to be able to detect mouse movement even when it is not over my
application. I can get the mouse cords using MousePosition but I am not
sure if there is an event that hits my program when the mouse is not over my
program.
One idea i had was make a child form that was transparent and use the
MouseMove event to keep that transparent window under the mouse but the
transparent window did not catch the MouseMove event.
I also tried putting a timer on the form that checks MousePosition but to
make it smooth i would have to check it so often that it is to processor
intensive.

Any help is appriciated,
Thanks in advance,
~Logan

Re: mouse move event Rafael J. Pellicer
9/16/2003 11:37:11 PM

With API: GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As
POINTAPI) As Long




"Logan Mckinley" <logan@globalweb.net> escribió en el mensaje
news:eNMX5kMfDHA.1872@TK2MSFTNGP09.phx.gbl...
[quoted text, click to view]

Re: mouse move event Logan Mckinley
9/17/2003 12:09:06 AM
Am i correct that this API will just return the location of the mouse? If
so I am currently able to get that using "Cursor.Position". My problem is i
need to query this every time the mouse moves and don't know the event that
fires when the mouse is not over my form.
Thanks,
~Logan

[quoted text, click to view]

Re: mouse move event Magnus Persson
9/17/2003 8:06:26 AM
You need to "Capture" the mouse, otherwise you will not receive mouse events
when pointer is outside your window.
To do this you set the Capture property of your form to true. When ever your
application looses focus you should set the Capture property back to false.

Normally you only use this "capture" function in controls within a form. If
you capture mouse events outside your main form I guess you need to pass the
events on to the window that the mouse hoovers.

/Magnus

[quoted text, click to view]

AddThis Social Bookmark Button