win12.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
WinTrackRect (1.2)
                                                      Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINTRACKRECT
 
BOOL WinTrackRect(hwnd, hps, pti)
HWND hwnd;         /* handle of the window                          */
HPS hps;           /* handle of the presentation space              */
PTRACKINFO pti;    /* address of structure for tracking information */
 
The WinTrackRect function draws a tracking rectangle.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hwnd       Identifies the window in which tracking is to take place. If
           hwnd identifies the desktop window or HWND_DESKTOP, tracking will
           take place over the entire screen. The style of this window
           cannot be WS_CLIPCHILDREN.
 
hps        Identifies the presentation space to be used for drawing the
           clipping rectangle. If hps is NULL, the hwnd parameter is used to
           calculate a presentation space for tracking. (It is assumed that
           tracking takes place within the window identified by hwnd and
           that the style of this window is not set to WS_CLIPCHILDREN.)
           When the drag rectangle appears, it is not clipped by any
           children within the window. If the window style is
           WS_CLIPCHILDREN and the application wants the drag rectangle to
           be clipped, it must explicitly pass an appropriate presentation
           space.
 
pti        Points to a TRACKINFO structure.
 
Return Value
 
The return value is TRUE if the function is successful. Otherwise, it is
FALSE, indicating that an error occurred or that the mouse was already
captured when WinTrackRect was called. Only one tracking rectangle may be
used at a time.
 
Comments
 
This function provides general-purpose mouse tracking. WinTrackRect draws a
rectangle and allows the user to position the entire rectangle or make a
specific side or corner smaller or larger. The resulting rectangle is then
returned to the application, which can use this new information for size and
position data. For example, to move and size windows by using the wide
sizing borders, the window manager interface simply calls WinTrackRect.
 
The WinTrackRect function allows the calling process to control such
limiting values as the minimum and maximum tracking size and the widths of
the tracking rectangle's sides.
 
If the TF_SETPOINTERPOS flag is included, the mouse pointer is positioned at
the center of the tracking rectangle. Otherwise, the mouse pointer is not
moved from its current position. At this point, there is an established
distance between the mouse position and the part of the tracking rectangle
that it moves, the value of which is kept constant.
 
While moving or sizing a tracking rectangle by using the keyboard, the mouse
pointer is repositioned along with the rectangle.
 
During tracking, the following keys are active:
 
Value  Meaning
────────────────────────────────────────────────────────────────────────────
ENTER  Accepts the new position or size.
 
LEFT   Moves the mouse pointer and tracking rectangle left.
 
UP     Moves the mouse pointer and tracking rectangle up.
 
RIGHT  Moves the mouse pointer and tracking rectangle right.
 
DOWN   Moves the mouse pointer and tracking rectangle down.
 
ESC    Cancels the current tracking operation. In this case, the value of
       the tracking rectangle is undefined on exit.
 
The mouse and keyboard interfaces can be used interchangeably. The caller
need not include the TF_SETPOINTERPOS flag to be able to use the keyboard
interface; this flag simply initializes the position of the mouse pointer.
 
Tracking movements using the ARROW keys are in increments of the cxKeyboard
and cyKeyboard fields, regardless of whether TF_GRID is specified. If
TF_GRID is specified, the interior of the tracking rectangle is allowed only
on multiples of cxGrid and cyGrid. The default value for cxGrid is the
system-font character width, and the default value for cyGrid is half the
height of the system font.
 
The rectangle tracked by WinTrackRect is guaranteed to be within the
specified tracking bounds and dimensions. If the rectangle passed is out of
these bounds, or is too large or too small, it is modified to a rectangle
that meets those limits.
 
See Also
 
WinBeginPaint, WinEndPaint, WinSetHook, WinUpdateWindow, TRACKINFO