Touch Screen (Stylus) Application Development (Windows CE 5.0)
Input events generated by the action of the stylus in a window are posted to the message queue of the thread that created the window. A window receives a stylus message when a stylus event occurs within the window client area. When the user presses the stylus to the screen, the window receives a WM_LBUTTONDOWN message. When the stylus is lifted from the screen, the window receives a WM_LBUTTONUP message. Occasionally, a window receives a WM_LBUTTONDBLCLK message instead of a WM_LBUTTONDOWN message. Substitution of a WM_LBUTTONDBLCLK message for a WM_LBUTTONDOWN message occurs under the following conditions:
- The window class was registered by using the CS_DBLCLKS class style.
- The stylus touches the screen within a certain distance of the last stylus location.
- The stylus touches the screen within a certain time limit after the stylus last touched the screen.
If the user moves the stylus while pressing it to the screen, Windows CE generates a WM_MOUSEMOVE message.
The following table shows the messages related to stylus input that Windows CE supports.
Message | Description |
---|---|
WM_LBUTTONDBLCLK | The user double-tapped the screen. |
WM_LBUTTONDOWN | The user pressed the screen. |
WM_LBUTTONUP | The user released the stylus from the screen. |
WM_MOUSEMOVE | The user moved the stylus while the tip was pressed to the screen. |
The lParam parameter of a stylus message indicates the position of the stylus tip. The low-order word is the x-coordinate and the high-order word is the y-coordinate. The coordinates are specified in the client coordinates. In the client-coordinate system, all points are specified in relation to the upper-left corner of the client area.
The wParam parameter contains flags that indicate the status of the CTRL and SHIFT keys at the time of the stylus event. Check for these flags when the way you process a stylus event depends on the state of the CTRL or SHIFT key.
The following table shows the flags that you can set in the wParam parameter.
Value | Description |
---|---|
MK_CONTROL | The CTRL key is down. |
MK_LBUTTON | The stylus is touching the screen. |
MK_SHIFT | The SHIFT key is down. |
See Also
Touch Screen (Stylus) | Receiving Double-Tap Messages | Capturing Touch Screen (Stylus) Input
Send Feedback on this topic to the authors