Solved

Extra mouse messages on double-click...

Posted on 1998-07-30
15
385 Views
Last Modified: 2013-11-19
I've got an MDI application in which I am processing left-mouse button messages.  When I get a LButtonDblClk message, for some reason I also get a MouseMove message.  Stranger yet, if I put a Sleep(100) call inside my LButtonDblClk handler I DON'T get the Mouse Move message. Could someone enlighten me here?  Thank you.
0
Comment
Question by:salamander
  • 6
  • 3
  • 3
  • +2
15 Comments
 
LVL 7

Expert Comment

by:galkin
ID: 1319942
I guess when you double click you move mouse pointer slightly so you get WM_MOUSEMOVE as well. If you call Sleep you suspend active thread associated with a window so it doesn't process WM_MOUSEMOVE
0
 

Author Comment

by:salamander
ID: 1319943
Not so fast... that was the first thing I checked when I saw this problem.  I made sure the mouse was absolutely unable to move - it still occurs.
0
 
LVL 7

Expert Comment

by:psdavis
ID: 1319944
What I do for all mouse messages is capture the initial location of the mouse down message.  Inside of my MouseMove, I can tell how far the mouse has actually moved by comparing against the MouseMove location.  If it is insignificant, I ignore the MouseMove message.  Then restore the initial location to CPoint( 0, 0 ) in the MouseUp message.

Phillip

0
 
LVL 7

Expert Comment

by:psdavis
ID: 1319945
Sorry about the answer, but I can't tell you why you won't get the message if you throw a sleep message in your double click handler.  

Phillip
0
 

Author Comment

by:salamander
ID: 1319946
No need to apologize about the answer, it's just not the one I'm looking for.  I will just leave the Sleep()-hack in the code for now, but not knowing why the message is there is KILLING me.  If I step through the LButtonDblClick code in the debugger, I also get no problem.  I just have to find out why it's happening... for my own sake.
0
 
LVL 2

Expert Comment

by:duneram
ID: 1319947
Windows just generates them.  When I used to install JournalRecordHooks and catch mouse messages I found I would get hundreds of WM_MOUSEMOVES even if I didn't move the mouse.  I wrote a filter that removed them and it had no effect on when I did the Journal playback hook.

I suspect the device driver is polling and posting this event on a regular basis.  


0
 

Author Comment

by:salamander
ID: 1319948
Hmmmm... this seems very strange.  Why would the device driver poll the mouse?  Wouldn't that be a terribly inefficient use of processor time?
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 7

Expert Comment

by:psdavis
ID: 1319949
Windows? Inefficient use of processor time?  Never heard of that! :)

0
 

Author Comment

by:salamander
ID: 1319950
:)  Ah, yes...
0
 
LVL 2

Expert Comment

by:duneram
ID: 1319951
there ya go
0
 
LVL 2

Expert Comment

by:duneram
ID: 1319952
when you put the sleep there, someone else is getting the mouse move's.  they're always being generated.  doing the sleep lets another thread/process have some time.  If the RIT (RAw input Thread) switches during that sleep (by the other thread/process), that new one will be receiving the mouse messages.  Its possible the desktop is getting them when you do the sleep.  
0
 
LVL 2

Accepted Solution

by:
AlFa earned 100 total points
ID: 1319953
I think it's a programming shortcut from window!
to generate a WM_LBUTTONDBLCLK message it need to have generated a WM_LBUTTONDOWN and a WM_LBUTTONUP when the second click happend the system transforms WM_LBUTTONDOWN into WM_LBUTTONDBLCLK  and the WM_LBUTTONUP  into WM_MOVE just to get rid of it. On NT 4.1 you got WM_LBUTTONDOWN WM_LBUTTONUP WM_LBUTTONDBLCLK  (it was a bug)!....
0
 

Author Comment

by:salamander
ID: 1319954
Is this a confirmed bug in Win95?  I would feel bad giving points to you for an answer which doesn't appear to be any more set in stone than the others.  I just don't want to give points to anyone before we know what the true culprit is...
0
 
LVL 2

Expert Comment

by:AlFa
ID: 1319955
I do not thing i said it was a win 95 bug. It is easier to transform a message than remove it. I've refered to the dble click bug of NT 4.1 wicth didn't do such a tranformation.
receiving a mousemove msg with no move shoudn't stress a program.
0
 

Author Comment

by:salamander
ID: 1319956
Ahhh... I'd forgotten about this problem entirely.  I ended up setting a boolean flag to true on LBUTTONDBLCLICK, setting it to false on LBUTTONUP.  This way I simply had and "if(!DblClkFlag)" statement in LBUTTONDOWN and everything ran great.  I would suggest the same to anyone reading this who has the same problem.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Question regarding Copy/Paste 16 87
Include multiple hostnames in this command? 3 52
format the code in java 6 72
withoutTen challenge 14 88
In this article, I'll describe -- and show pictures of -- some of the significant additions that have been made available to programmers in the MFC Feature Pack for Visual C++ 2008.  These same feature are in the MFC libraries that come with Visual …
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now