Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I determine the amount of movement a mouse is allowed between two click for the WM_LBUTTONDBLCLK message to be fired?

How can I determine the amount of movement a mouse is allowed between two click for the WM_LBUTTONDBLCLK message to be fired?

MSDN Receiving Double-Click Messages

The OS generates a double-click message when the user clicks a mouse button twice in quick succession. When the user clicks a button, the OS establishes a rectangle centered on the hot spot of the cursor. The OS also marks the time at which the click occurred. When the user clicks the same button a second time, the OS determines whether the hot spot is still within the rectangle and calculates the time elapsed since the first click. If the hot spot is still within the rectangle and the elapsed time does not exceed the time-out value for a double-click, the OS generates a double-click message. An application can retrieve the time-out value for a double-click by using the GetDoubleClickTime function.

I am able to determine the maximum allowed time interval GetDoubleClickTime but would like to know the maximum of mouse moment allowed.

like image 283
ClassicThunder Avatar asked Feb 10 '23 00:02

ClassicThunder


1 Answers

From the documentation for GetSystemMetrics:

The second click must occur within the rectangle that is defined by SM_CXDOUBLECLK and SM_CYDOUBLECLK for the system to consider the two clicks a double-click.

int x_limit = GetSystemMetrics(SM_CXDOUBLECLK);
int y_limit = GetSystemMetrics(SM_CYDOUBLECLK);
like image 152
Jonathan Potter Avatar answered Feb 13 '23 12:02

Jonathan Potter