MouseMove event continually being called

  • Thread starter Thread starter Bob Dankert
  • Start date Start date
B

Bob Dankert

I have a control which inherits from TabControl and is having some issues
with the MouseMove event being continously called when the mouse is over the
tab on the top portion. When this happens, my CPU goes to 100% utilization
and causes all sorts of issues. The odd thing about this issue is that it
only happens in some of the programs which use the control and does not
happen in others. I have tried copying the code for the windows forms code
from one working program to a non-working program to try and fix the issue
but have been unsuccessful (all properties are the exact same).

I have added some trace events to see what is causing this by adding the
following code to the MouseMove event:

Dim st As New System.Diagnostics.StackTrace
System.Diagnostics.Trace.WriteLine("On Mouse Move - Stack Trace Count: " +
st.FrameCount.ToString())
Dim i As Int16
For i = 1 To st.FrameCount
System.Diagnostics.Trace.WriteLine(st.GetFrame(i))
Next

System.Diagnostics.Trace.WriteLine("e.x: " + e.X.ToString() + " e.y: " +
e.Y.ToString() + " e.clicks: " + e.Clicks.ToString() + " e.button: " +
e.Button.ToString() + " e.delta: " + e.Delta.ToString())


With this, I get the following results. Please note that none of the mouse
parameters ever change, and I get tens or hundreds of these a second (the
whole time without touching my mouse):

e.x: 143 e.y: 9 e.clicks: 0 e.button: None e.delta: 0
On Mouse Move - Stack Trace Count: 14
WmMouseMove at offset 172 in file:line:column <filename unknown>:0:0
WndProc at offset 1588 in file:line:column <filename unknown>:0:0
WndProc at offset 399 in file:line:column <filename unknown>:0:0
WndProc at offset 380 in file:line:column <filename unknown>:0:0
OnMessage at offset 19 in file:line:column <filename unknown>:0:0
WndProc at offset 218 in file:line:column <filename unknown>:0:0
DebuggableCallback at offset 61 in file:line:column <filename unknown>:0:0
DispatchMessageW at offset 0 in file:line:column <filename unknown>:0:0
System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop
at offset 841 in file:line:column <filename unknown>:0:0
RunMessageLoopInner at offset 499 in file:line:column <filename unknown>:0:0
RunMessageLoop at offset 80 in file:line:column <filename unknown>:0:0
Run at offset 52 in file:line:column <filename unknown>:0:0
Main at offset 235 in file:line:column <filename unknown>:0:0
e.x: 143 e.y: 9 e.clicks: 0 e.button: None e.delta: 0
WmMouseMove at offset 172 in file:line:column <filename unknown>:0:0
WndProc at offset 1588 in file:line:column <filename unknown>:0:0
WndProc at offset 399 in file:line:column <filename unknown>:0:0
WndProc at offset 380 in file:line:column <filename unknown>:0:0
OnMessage at offset 19 in file:line:column <filename unknown>:0:0
WndProc at offset 218 in file:line:column <filename unknown>:0:0
DebuggableCallback at offset 61 in file:line:column <filename unknown>:0:0
DispatchMessageW at offset 0 in file:line:column <filename unknown>:0:0
System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop
at offset 841 in file:line:column <filename unknown>:0:0
RunMessageLoopInner at offset 499 in file:line:column <filename unknown>:0:0
RunMessageLoop at offset 80 in file:line:column <filename unknown>:0:0
Run at offset 52 in file:line:column <filename unknown>:0:0
Main at offset 235 in file:line:column <filename unknown>:0:0
e.x: 143 e.y: 9 e.clicks: 0 e.button: None e.delta: 0

I appreciate any help with this matter.

Thanks,

Bob Dankert
 
Hi Bob,

Thanks for your post.

Based on my understanding, you created a customized TabControl, which may
cause many unexpected MouseMove events without mouse moving.

It seems that WM_MOUSEMOVE messages is sent/posted to the application
unexpectedly and continuously. I suggest you use SPY++ to monitor the
TabControl's WM_MOUSEMOVE message to verify this. You can also view the
"Message Code" column of the WM_MOUSEMOVE messages to confirm if it is
marked with "S" or "P". The "S" standards for sent message, while "P"
standards for posted message.

However, based on the call stack you provided, it should be a correctly
hardware generated WM_MOUSEMOVE messages, there is nothing special point.

Have you tried your problem project on other machiens? Does this problem
exist on every machine? If so, I suggest you create a sample problem
project, then attach it in a further reply. With the reproduce sample, we
can understand your problem better and give some useful suggestion. Thanks
============================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Thanks for the reply Jeffrey, sorry for the late response (I was on a short
vacation).

I have tried this on other machines and the issue is reproducible. The
trouble is reproducing this issue in other projects. The tabcontrol exists
in a DLL file and is used by several programs I have created. So far, the
issue is present in 2 programs (the issue exists for every single tabcontrol
in the program) and the other 5 programs do not exhibit the behavior
what-so-ever. This has made it difficult to reproduce the issue as I can
not pinpoint what is different between the two solutions. They are all
using visual styles (I tried using both manifest file and
Application.EnableVisualStyles), and it makes no difference if visual styles
are turned off. The form's which use the tabcontrol can have the code
copied from one project to another and exhibit the problem behavior only in
one project (but the problem is consistent on every machine). This makes it
seem as though it is related to something with the entire project, but I am
running out of ideas.

Thanks,

Bob
 
Hi Bob,

Thanks for your feedback.

For your last statement, "The form's which use the tabcontrol can have the
code copied from one project to another and exhibit the problem behavior
only in
one project (but the problem is consistent on every machine). This makes
it seem as though it is related to something with the entire project", it
seems that this problem is project specific, after copying the code to the
new project, this problem goes away. Yes?

If I did not misunderstand you, it seems that your problem should go away
in the new project. If so, can you work with the new project? Do you still
have any concern?
==============================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Unfortunately, I was not able to get rid of it by playing with components of
the project. To get around this, I check all of the event arguments and
cancel the event if nothing has changed. It still eats some CPU cycles
since it is calling the event each time, but at least it is not nearly as
bad as previously.

Bob
 
Hi Bob,

Thanks for your feedback.

It seems that you can not live with the new copied project, yes? You still
want to get rid of problem in the original project.

Looking at the nature of this issue, it would require intensive
troubleshooting which would be done quickly and effectively with direct
assistance from a Microsoft Support Professional through Microsoft Product
Support Services. Then there will be a Microsoft support engineer work with
your project one by one.

You can contact Microsoft Product Support directly to discuss additional
support options you may have available, by contacting us at 1-(800)936-5800
or by choosing one of the options listed at
http://www.microsoft.com/services/microsoftservices/srv_support.mspx

Hope this helps

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top