c# - "Ghost" MouseMove event in WinForms -


i have custom control updates 2 numericupdowns current mouse coordinates handling mousemove event.

however have experienced strange case mousemove event fired when should not happen (i have turned off wireless mouse , disabled trackpad). so, mousemove happens if mouse not move.

i've made simple check , verified between these "ghost" mousemove events position of mouse pointer not change. exploited advantage make sure method handling event called when pointer has moved, have been able meet requirements application.

however, still puzzled, don't understand fire mousemove events when mice/trackpads disabled. looking @ call stack in visual studio, seems me firing of mousemove event "genuine", if mouse moved, not if fired other part of application (e.g. simulate mousemove).

any suggestions on might reason this? thank you!

edit: following king king's suggestion, modified code print string every time message mousemove detected. i've noticed when mouse off , pointer hovering control, string printed when alt-tab switch between application. perhaps has application being redrawn?

windows synthesizes fake wm_mousemove message sometimes. in particular happen on focus change 1 window another. window gets focus gets move message. seeing happen when use alt+tab excellent lead indeed source of message.

this entirely intentional. ensures other train of messages triggered wm_mousemove occur. in particular wm_nchittest , wm_setcursor. correct mouse cursor shape displayed. otherwise affected in winforms control.cursor , application.usewaitcursor properties.

you'll have live this, make sure never problem.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -