The Generic sample application illustrates some of the basic graphics and windowing techniques of Windows CE. The Generic application creates a window and draws a horizontal line. This line bisects the client area, creating two equal halves. The user can click in either half of the window. The upper half of the screen cycles through the color palette when clicked. The lower half of the screen displays squares when clicked.
To build the Generic sample application, follow the procedure described in Building the Sample Applications. In the procedure, select one of the following project configurations:
After the Generic sample application loads and initializes its main window, it calls WndProc. The main purpose of WndProc is to determine if the user selects the upper or lower half of the window. WndProc then calls PaintWindow. PaintWindow either changes the color of the upper half of the window or draws boxes in the lower half of the window, depending on which half the user clicked.
This sample application resembles the Generic sample application for an H/PC. However, the Generic sample application for an H/PC divides the screen into four quadrants. Like the Generic sample application for an H/PC, the Generic sample application for a Palm-size PC cycles through the color palette and draws boxes. However, because a Palm-size PC application should not have the exit or minimize UI, the Generic sample application for a Palm-size PC does not have those functions.
The Generic sample application uses the following messages:
WM_CLOSE |
WM_LBUTTONDOWN |
WM_DESTROY |
WM_PAINT |
The Generic sample application uses the following APIs and functions:
BeginPaint | GetMessage | RegisterClass |
CreateWindow | GetStockObject | ReleaseDC |
DefWindowProc | GetStockPen | rgiBrushColors |
DestroyWindow | InitApplication | SelectPen |
DispatchMessage | InitInstance | SetForegroundWindow |
DrawText | IsWindow | ShowWindow |
EndPain | LoadString | sizeof |
FillRect | MessageBox | UpdateWindow |
FindWindow | POINTSTOPOINT | WinMain |
GetDC | Polyline | WndProc |
GetClientRect | PostQuitMessage |