The ETCHA sample is a simple drawing application that demonstrates how to handle stylus input. The stylus is treated as a mouse. Touching the screen sends the WM_LBUTTONDOWN message; moving the stylus sends the WM_MOUSEMOVE message; and lifting the stylus from the screen sends the WM_LBUTTONUP message.
The main application window is used for drawing. Move the stylus around the main window to draw. Tap File then New to erase any drawing in the window.
ETCHA keeps track of two points in an array of CPoint objects. The handler OnLButtonDown sets the current array item to the current position of the stylus on the screen. OnMouseMove then sets the next array item to the new current position and draws a line from point to point, using the Polyline function.
A Windows CE device would only send WM_MOUSEMOVE messages when the stylus was touching the screen. The test for the flag MK_LBUTTON is only necessary for the emulation environment, where there is a mouse. However, it is good practice to keep code portable.
This sample demonstrates the following keywords:
You can find the ETCHA project files in the Wce\Samples\Mfc\ETCHA directory.
For information on the Windows CE platforms that support this sample, see MFC for Windows CE Samples.