Export (0) Print
Expand All

Receiving Double-Click Messages

Windows Mobile 6.5
A version of this page is also available for
4/8/2010

Applications on Windows® phones process touch events as a click of the left mouse button, so support for mouse input can be important to your OS design.

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.

An application-defined window does not, by default, receive double-click messages. Because of the system overhead involved in generating double-click messages, these messages are generated only for windows belonging to classes that have the CS_DBLCLKS class style. Your application must set this style when registering the window class.

A double-click message is always the third message in a series of four messages. The first two messages are the button-down and button-up messages generated by the first click. The second click generates the double-click message followed by another button-up message. For example, double-clicking the left mouse button generates the following message sequence:

  1. WM_LBUTTONDOWN
  2. WM_LBUTTONUP
  3. WM_LBUTTONDBLCLK
  4. WM_LBUTTONUP

Because a window always receives a button-down message before receiving a double-click message, an application typically uses a double-click message to extend a task that the application began during a button-down message.

Community Additions

ADD
Show:
© 2014 Microsoft