Solved

Extra mouse messages on double-click...

Posted on 1998-07-30
15
390 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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
 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
cat dog challenge 18 126
Error on moodle after upgrade 3 140
ORA-01403: no data found 43 106
Define unique primary key 9 95
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
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.
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

856 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