Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windows Controls
Visual Styles
Functions
 BeginBufferedPaint Function
BeginBufferedPaint Function

Begins a buffered paint operation.

Syntax

HPAINTBUFFER BeginBufferedPaint(      
    HDC hdcTarget,     const RECT *prcTarget,     BP_BUFFERFORMAT dwFormat,     BP_PAINTPARAMS *pPaintParams,     HDC *phdc );

Parameters

hdcTarget
The handle of the target device context (DC) on which the buffer will be painted.
prcTarget
A pointer to a RECT structure that specifies the area of the target DC in which to paint.
dwFormat
A member of the BP_BUFFERFORMAT enumeration that specifies the format of the buffer.
pPaintParams
[in] A pointer to a BP_PAINTPARAMS structure that defines the paint operation parameters. This value can be NULL.
phdc
[out] When this function returns, points to the handle of the new device context.

Return Value

A handle to the buffered paint context. If this function fails, the return value is NULL, and phdc is NULL. To get extended error information, call GetLastError.

The returned handle is freed when EndBufferedPaint is called.

An application should call BufferedPaintInit on the calling thread before calling BeginBufferedPaint, and BufferedPaintUnInit before the thread is terminated. Failure to call BufferedPaintInit may result in degraded performance due to internal data being initialized and destroyed for each buffered paint operation.

Example

void BufferedPaint(HDC hdc, const RECT *prcPaint)

{
    BP_PAINTPARAMS paintParams = {0};
    paintParams.cbSize = sizeof(paintParams);

    HDC hdcBuffer;
    HPAINTBUFFER hBufferedPaint = BeginBufferedPaint(hdc, prcPaint, BPBF_COMPATIBLEBITMAP, &paintParams, &hdcBuffer);

    if (hBufferedPaint)
    {
        // Application specific painting code
        AppPaint(hdcBuffer, prcPaint);
        EndBufferedPaint(hBufferedPaint, TRUE);
    }
    else
    {
        // Error occurred, default to unbuffered painting
        AppPaint(hdc, prcPaint);
    }
}

Function Information

Stock ImplementationUxTheme.dll
Custom ImplementationNo
Headeruxtheme.h
Import libraryNone
Minimum operating systems Windows Vista
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Import library: uxtheme.lib      mvadu   |   Edit   |   Show History

You'll need to link to uxtheme.lib, else you will get linker error LNK2019: unresolved external symbol.

To import in Visual Studio go to Project -> Properties-> Linker->Input-> Additional dependencies: uxtheme.lib

Tags What's this?: Add a tag
Flag as ContentBug
Processing
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker