Timer for Single Click and Double Click

I am making an MFC application that allows the user to draw in a system that I will analyze. The user will use the left mouse button and right mouse button to draw the system (single click and drag). The user will double-click with the left mouse button in order for a dialog box to pop-up for the user to enter the item's data. My problem is when I double click with the left mouse button, the LeftMouseButtonDown function is called before the LeftMouseButtonDoublClick function. This is causing me great pain b/c it executes code that I don't want it to. I need some sort of timer to make the OnLeftButtonDown function wait to see if the user is double-clicking before calling that function. Help ME!!!!

You can use the GetDoubleClickTime function retrieves the current double-click time for the mouse. In your OnLButtonDown, set a one shot timer using the timeSetEvent function. In your OnLButtonDblClk, set a flag to indicate if it is a double-click. When the timer callback function is called, check the flag and do your LeftMouseButtonDown function if it is not a double-click. This is just a rough design.

Featured Post

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Introduction:
Dialogs (1) modal - maintaining the database.
Continuing from the ninth article about sudoku.
You might have heard of modal and modeless dialogs. Here with this Sudoku application will we use one of each type: a modal dialog …

Exception Handling is in the core of any application that is able to dignify its name.
In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.