• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 647
  • Last Modified:

How to use WM_LBUTTONDBLCLK in visual C++ 6?

I need to add a code into doubleclick event but somehow it crash with the WM_LBUTTONDOWN event. Please give help me..
I have added CS_DBLCLKS into window style as well but no help..

Thanks in advance
1 Solution
Jose ParrotGraphics ExpertCommented:

When using WM_LBUTTONDBLCLCK, the event is not actually a double click, but the second click within the double-click time.

So, doubleclick time must be defined before. Assuming your program isn't seting this,it will use the time defined at user level, that is, the Windows settings (default is 500 ms), outside your program.

If you want to define at runtime, should call the SetDoubleClickTime function.

I am surprised with no results, because you have used CS_DBLCLKS correctly in the window class style (MUST use it to enable receive doubleclick messages).

Are you using ScreenToClient and ClientToScreen for converting back and forth between the different coordinates? In general, we use it in conjunction with GetCursorPos to get mouse cursor's position. May be the crashes are caused by wrong coordinates not directly related to your code objectives.

Pay attention also on:
The member function OnLButtonDblClk is called by the framework to allow your application to handle a Windows message. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function.


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now