This sample dynamic-link library contains functions that you can use to carry out selections by using the mouse. The functions are based on the graphics selection method described in Chapter 6, “Cursors.” These functions provide two kinds of selection feedback: a box that shows the outline of the selection, and a block that shows the entire selection inverted. The library exports the following functions:
Function | Action |
StartSelection | Starts the selection and initializes the selection rectangle. When selecting with the mouse, you call this function when you receive a WM_LBUTTONDOWN message. |
UpdateSelection | Updates the selection box or block. When selecting with the mouse, you call this function when you receive a WM_MOUSEMOVE message. |
EndSelection | Ends the selection and fills in the selection rectangle with the final selection dimensions. When selecting with the mouse, you call this function when you receive a WM_LBUTTONUP message. |
ClearSelection | Clears the selection box or block from the screen and empties the selection rectangle. |
The selection rectangle is a RECT structure that the application supplies and that the library functions fill in. The coordinates given in the rectangle are client coordinates.
To create this library you need to create several files:
File | Contents |
SELECT.C | The C-language source for selection functions |
SELECT.DEF | The module-definition file for the Select library |
SELECT.H | The header file for the Select library |
SELECT | The makefile for the Select library |
SELECT.LIB | The import library for the Select library |
The Select library does not have an initialization file because the functions do not use a local heap and because no other initialization is necessary.