Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

WM_LBUTTONDOWN in Subclassed CHeaderCtrl

Posted on 2002-07-01
4
Medium Priority
?
642 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:
Vinayak Kumbar earned 400 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

971 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