Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a dialog based application in which when i move cursor over one widget a description about that is shown by me but when i move the cursor from that widget quickly outside the window the description just get stuck ,means that the OnMouseMove() function does not get called,I tried OnNcHitTest() too but result remain the same.
Please help me to find the solution of this problem
Posted
Comments
Kasson 20-Jan-11 1:09am    
What code you have written for this, based on the code only we can fix it.
anonymous1310 20-Jan-11 1:25am    
when my mouse hover the widget i am calling Invalidate(),the description has been drawn by me in the OnPaint(),but when mouse moves quickly the OnMouseMove() does not get called so the Invalidate() also does not get called that stops the window to get repainted,and widget's description get stucked.
Sergey Alexandrovich Kryukov 20-Jan-11 1:32am    
I doubt this description is absolutely precise, but should be close. You see, multiple calls to Invalidate accumulate: invalidated subsets of the canvas are ORed together into a resulting union of the subsets which is cleaned by the nearest processed WM_PAINT. WM_PAINT event, in turn, is not queued (I mean, processed in a special way, so "overpaint" does not happen: instead of multiple WM_PAINT you receive just one, before next Invalidate). What happen is inter-play of mouse and WM_PAINT events with your code.

After some thinking on your comment: there is one more completely different key thing to it.

A key is your "outside the window". I don't know how you detect the condition of moving outside, but I don't thing you capture the mouse, right? (Otherwise you would mention that.) When a mouse pointer is outside and mouse is not captured, you get not mouse events at all.

I means you also need to handle MouseLeave event.
 
Share this answer
 
Comments
anonymous1310 20-Jan-11 4:03am    
I have tried MouseLeave event too but even that is not getting called on a quick movement of mouse.
Sergey Alexandrovich Kryukov 20-Jan-11 10:21am    
How do you know the handler is not called? It all comes to the point looking at your code is needed. Also, you can simplify the situation down; create artificially slow handler of WM_MOUSEMOVE, some indicator of all events, write events is system log. Try to validate every your statement...
anonymous1310 21-Jan-11 3:15am    
by debugging ,i came to know that the control did not reach in mouseleave and in a mousemove event.
Sergey Alexandrovich Kryukov 21-Jan-11 20:40pm    
OK, then you will need to do more thorough debugging or present some minimalistic code to demonstrate the problem, of both.
Thank you.
--SA
The WM_MOUSEMOVE message is generated by the mouse driver every time GetMessage is called (typically: at every turn of the message loop) if the mouse coordinates and state are found different.

In your case, most probably, the "quick motion" makes the mouse to fall outside the widget surface in a time less than a loop (so the message goes to another window).

If you want to track mouse movement into a window you should "capture" the mouse to retain all activity in that window (even if the mouse lays outside), until you can safely decide that mouse input isn't anymore pertinent to it.

See SetCapture [^]/ ReleaseCapture[^].
 
Share this answer
 
Comments
anonymous1310 20-Jan-11 3:58am    
thanks,I have already tried that and it worked but i can't use these function in my code,as there are some other problem arises from it ,is there any other thing which i can try.
This is possible.

I don't think your event is missing. You simply process the event too slowly, so when next hardware interrupts from mouse happen, your application is still hanging in handling the event triggered by some earlier hardware interrupt -- pretty usual thing.

You cannot avoid it. You can only redefine the logic of your processing the way that it does not assume that you can process all the events in time. In other words, you either need to find a way to ignore some events or make processing faster by deferring time-consuming processing. This way, you could merge your deferred events at the expense of ignoring older event which are not actual anymore.

Particular schema needs some thinking and more information on what your application is supposed to do.
 
Share this answer
 
v3
MSDN[^] will give an Idea.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900