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.
WinBeginPaint (1.2)
Function Group  Overview                          Up Next Previous
────────────────────────────────────────────────────────────────────────────
 
#define INCL_WINWINDOWMGR
 
HPS WinBeginPaint(hwnd, hps, prclPaint)
HWND hwnd;           /* handle of the window handle                 */
HPS hps;             /* handle of the presentation space            */
PRECTL prclPaint;    /* address of structure for bounding rectangle */
 
The WinBeginPaint function obtains a presentation space whose visible region
is the window's update region. This sets up the presentation space so that
any drawing will only occur within the update region. The presentation space
can be an existing one supplied to this function, in which case its visible
region will be set to the update region of hwnd. Otherwise, a cached
presentation space is obtained specifically for the window.
 
The WinEndPaint function must be called when drawing is complete.
 
Parameter  Description
────────────────────────────────────────────────────────────────────────────
 
hwnd       Identifies the window where drawing will occur.
 
hps        Identifies the presentation space to use. If this parameter is
           NULL, a cache presentation space is created.
 
prclPaint  Points to a RECTL structure that will be set to the smallest
           rectangle bounding the update region.
 
Return Value
 
The return value is a handle to a presentation space, or NULL if an error
occurred.
 
Comments
 
This function hides the cursor, if it is in the window, until the
WinEndPaint function is called.
 
Example
 
This example calls WinBeginPaint when it receives a WM_PAINT message to get
a presentation-space handle to the update region, and to get the coordinates
of the update rectangle. It then fills the update rectangle and calls
WinEndPaint to release the presentation space.
 
case WM_PAINT:
    hps = WinBeginPaint(hwnd,   /* handle of the window      */
        (HPS) NULL,             /* get a cache ps            */
        &rcl);                  /* receives update rectangle */
    WinFillRect(hps, &rcl, CLR_WHITE);
    WinEndPaint(hps);
 
See Also
 
WinEndPaint, RECTL, WM_PAINT