Solved

WM_LBUTTONDOWN in Subclassed CHeaderCtrl

Posted on 2002-07-01
4
614 Views
Last Modified: 2013-11-20
Hi,
I have subclassed the CHeaderCtrl in a CListCtrl.
Now I want to handle the "WM_LBUTTONDOWN" event but unfortunately I get about half calls then I actually pressed on the header (only if I press slowly I get all the pressing). I need to get all the LButtonDown events even if I press quickly.
Can someone please explain to me why this is happaning ?

BTW, I notice that it happans in all the list controls (even in the Explorer).

thanks,
Yoav.


0
Comment
Question by:yoavo
4 Comments
 
LVL 4

Expert Comment

by:mblat
ID: 7122604
Try to get your messages in PreTranslateMessage() handler...
0
 
LVL 3

Expert Comment

by:Melange
ID: 7122776
If you press quickly the second LBUTTONDOWN message will get converted to double clicks.

You have two choices:

1. Handle OnLButtonDblClk
2. Do what mblat suggested and override PreTranslateMessage to prevent the conversion to double clicks.
0
 

Author Comment

by:yoavo
ID: 7123810
I tried to handle PreTranslateMessage, but this does not help... The events still coming "less than expected"...
0
 
LVL 8

Accepted Solution

by:
VinExpert earned 100 total points
ID: 7129082
Hi Yoavo,

As Melange told, ur single LBUTTONDOWNs when pressed quickly will be converted into the DOUBLE CLICKS and will be routed to double click handler. If U want to check it, go to control panel -> Mouse. There change the double click speed to fastest possible. Then try it in that test area. Now, U will be getting all as single clicks!!!

I dont think it is possible to control it by overriding PreTranslateMessage as even that function also gets that message as the double click. There is a limit. U need to depend on that timing factor which mouse (driver) thinks that it as a single click or double click.

U can change that speed programatically by using SystemParametersInfo(...) function with SPI_SETDOUBLECLICKTIME action.

Try it out.
VinExpert
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

785 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