BufferedPaintRenderAnimation function (uxtheme.h)
Paints the next frame of a buffered paint animation.
Syntax
BOOL BufferedPaintRenderAnimation(
HWND hwnd,
HDC hdcTarget
);
Parameters
hwnd
Type: HWND
Handle to the window in which the animations play.
hdcTarget
Type: HDC
Handle of the target DC on which the buffer is animated.
Return value
Type: BOOL
Returns TRUE if the frame has been painted, or FALSE otherwise.
Remarks
If this function returns TRUE, the application should do no further painting. If this function returns FALSE, the application should paint normally.
An application calls this function within its WM_PAINT handler. After BufferedPaintRenderAnimation paints an animation frame, an application will typically continue without performing its usual painting operations. If appropriate, an application may choose to render additional user interface (UI) over the top of the animation. The following code example, to be included as part of a larger body of code, shows how to use the animation painting functions.
if (!_fBufferedPaintInit)
{
BufferedPaintInit();
_fBufferedPaintInit = TRUE;
}
// Determine whether the paint message was generated by a softfade animation.
if (!BufferedPaintRenderAnimation(hWnd, hdc))
{
// Initialize buffered paint parameters.
BP_ANIMATIONPARAMS animParams = {sizeof(BP_ANIMATIONPARAMS)};
animParams.style = BPAS_LINEAR;
animParams.dwDuration = 0;
GetThemeTransitionDuration(hTheme, iPartId, iStateIdFrom,
iStateIdTo, TMT_TRANSITIONDURATIONS, &animParams.dwDuration);
HDC hdcFrom, hdcTo;
HANIMATIONBUFFER hbpAnimation = BeginBufferedAnimation(hWnd, hdc, &rc,
BPBF_COMPATIBLEBITMAP, NULL, &animParams, &hdcFrom, &hdcTo);
if (hbpAnimation)
{
if (hdcFrom)
{
PaintImpl(hdcFrom, iPartId, iStateIdFrom /*, ...*/);
}
if (hdcTo)
{
PaintImpl(hdcTo, iPartId, iStateIdTo/*, ...*/);
}
EndBufferedAnimation(hbpAnimation, TRUE);
}
else
{
// Default to unbuffered paint
PaintImpl(hdc, iPartId, iStateIdTo/*, ...*/);
}
}
// Else do not paint because the BufferedPaintRenderAnimation function
// already did.
}
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows Vista [desktop apps only] |
Minimum supported server | Windows Server 2008 [desktop apps only] |
Target Platform | Windows |
Header | uxtheme.h |
DLL | UxTheme.dll |