ホーム › UI.Controls › BufferedPaintRenderAnimation
BufferedPaintRenderAnimation
関数進行中のバッファアニメーションの現フレームを描画する。
シグネチャ
// UXTHEME.dll
#include <windows.h>
BOOL BufferedPaintRenderAnimation(
HWND hwnd,
HDC hdcTarget
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hwnd | HWND | in | アニメーションを再生するウィンドウのハンドルです。 |
| hdcTarget | HDC | in | バッファーがアニメーション表示される対象 DC のハンドルです。 |
戻り値の型: BOOL
公式ドキュメント
バッファー描画アニメーションの次のフレームを描画します。
戻り値
Type: BOOL
フレームが描画された場合は TRUE を、それ以外の場合は FALSE を返します。
解説(Remarks)
この関数が TRUE を返す場合、アプリケーションはそれ以上の描画を行わないでください。この関数が FALSE を返す場合、アプリケーションは通常どおり描画してください。
アプリケーションは、この関数を WM_PAINT ハンドラー内で呼び出します。BufferedPaintRenderAnimation がアニメーションフレームを描画した後、アプリケーションは通常、普段の描画処理を行わずに続行します。必要に応じて、アプリケーションはアニメーションの上に追加のユーザーインターフェイス (UI) を描画することもできます。次のコード例は、より大きなコードの一部として組み込むことを想定したもので、アニメーション描画関数の使い方を示しています。
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.
}
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// UXTHEME.dll
#include <windows.h>
BOOL BufferedPaintRenderAnimation(
HWND hwnd,
HDC hdcTarget
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("UXTHEME.dll", ExactSpelling = true)]
static extern bool BufferedPaintRenderAnimation(
IntPtr hwnd, // HWND
IntPtr hdcTarget // HDC
);<DllImport("UXTHEME.dll", ExactSpelling:=True)>
Public Shared Function BufferedPaintRenderAnimation(
hwnd As IntPtr, ' HWND
hdcTarget As IntPtr ' HDC
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' hwnd : HWND
' hdcTarget : HDC
Declare PtrSafe Function BufferedPaintRenderAnimation Lib "uxtheme" ( _
ByVal hwnd As LongPtr, _
ByVal hdcTarget As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
BufferedPaintRenderAnimation = ctypes.windll.uxtheme.BufferedPaintRenderAnimation
BufferedPaintRenderAnimation.restype = wintypes.BOOL
BufferedPaintRenderAnimation.argtypes = [
wintypes.HANDLE, # hwnd : HWND
wintypes.HANDLE, # hdcTarget : HDC
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('UXTHEME.dll')
BufferedPaintRenderAnimation = Fiddle::Function.new(
lib['BufferedPaintRenderAnimation'],
[
Fiddle::TYPE_VOIDP, # hwnd : HWND
Fiddle::TYPE_VOIDP, # hdcTarget : HDC
],
Fiddle::TYPE_INT)#[link(name = "uxtheme")]
extern "system" {
fn BufferedPaintRenderAnimation(
hwnd: *mut core::ffi::c_void, // HWND
hdcTarget: *mut core::ffi::c_void // HDC
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("UXTHEME.dll")]
public static extern bool BufferedPaintRenderAnimation(IntPtr hwnd, IntPtr hdcTarget);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UXTHEME_BufferedPaintRenderAnimation' -Namespace Win32 -PassThru
# $api::BufferedPaintRenderAnimation(hwnd, hdcTarget)#uselib "UXTHEME.dll"
#func global BufferedPaintRenderAnimation "BufferedPaintRenderAnimation" sptr, sptr
; BufferedPaintRenderAnimation hwnd, hdcTarget ; 戻り値は stat
; hwnd : HWND -> "sptr"
; hdcTarget : HDC -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "UXTHEME.dll"
#cfunc global BufferedPaintRenderAnimation "BufferedPaintRenderAnimation" sptr, sptr
; res = BufferedPaintRenderAnimation(hwnd, hdcTarget)
; hwnd : HWND -> "sptr"
; hdcTarget : HDC -> "sptr"; BOOL BufferedPaintRenderAnimation(HWND hwnd, HDC hdcTarget)
#uselib "UXTHEME.dll"
#cfunc global BufferedPaintRenderAnimation "BufferedPaintRenderAnimation" intptr, intptr
; res = BufferedPaintRenderAnimation(hwnd, hdcTarget)
; hwnd : HWND -> "intptr"
; hdcTarget : HDC -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
uxtheme = windows.NewLazySystemDLL("UXTHEME.dll")
procBufferedPaintRenderAnimation = uxtheme.NewProc("BufferedPaintRenderAnimation")
)
// hwnd (HWND), hdcTarget (HDC)
r1, _, err := procBufferedPaintRenderAnimation.Call(
uintptr(hwnd),
uintptr(hdcTarget),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction BufferedPaintRenderAnimation(
hwnd: THandle; // HWND
hdcTarget: THandle // HDC
): BOOL; stdcall;
external 'UXTHEME.dll' name 'BufferedPaintRenderAnimation';result := DllCall("UXTHEME\BufferedPaintRenderAnimation"
, "Ptr", hwnd ; HWND
, "Ptr", hdcTarget ; HDC
, "Int") ; return: BOOL●BufferedPaintRenderAnimation(hwnd, hdcTarget) = DLL("UXTHEME.dll", "bool BufferedPaintRenderAnimation(void*, void*)")
# 呼び出し: BufferedPaintRenderAnimation(hwnd, hdcTarget)
# hwnd : HWND -> "void*"
# hdcTarget : HDC -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "uxtheme" fn BufferedPaintRenderAnimation(
hwnd: ?*anyopaque, // HWND
hdcTarget: ?*anyopaque // HDC
) callconv(std.os.windows.WINAPI) i32;proc BufferedPaintRenderAnimation(
hwnd: pointer, # HWND
hdcTarget: pointer # HDC
): int32 {.importc: "BufferedPaintRenderAnimation", stdcall, dynlib: "UXTHEME.dll".}pragma(lib, "uxtheme");
extern(Windows)
int BufferedPaintRenderAnimation(
void* hwnd, // HWND
void* hdcTarget // HDC
);ccall((:BufferedPaintRenderAnimation, "UXTHEME.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{Cvoid}),
hwnd, hdcTarget)
# hwnd : HWND -> Ptr{Cvoid}
# hdcTarget : HDC -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t BufferedPaintRenderAnimation(
void* hwnd,
void* hdcTarget);
]]
local uxtheme = ffi.load("uxtheme")
-- uxtheme.BufferedPaintRenderAnimation(hwnd, hdcTarget)
-- hwnd : HWND
-- hdcTarget : HDC
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('UXTHEME.dll');
const BufferedPaintRenderAnimation = lib.func('__stdcall', 'BufferedPaintRenderAnimation', 'int32_t', ['void *', 'void *']);
// BufferedPaintRenderAnimation(hwnd, hdcTarget)
// hwnd : HWND -> 'void *'
// hdcTarget : HDC -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("UXTHEME.dll", {
BufferedPaintRenderAnimation: { parameters: ["pointer", "pointer"], result: "i32" },
});
// lib.symbols.BufferedPaintRenderAnimation(hwnd, hdcTarget)
// hwnd : HWND -> "pointer"
// hdcTarget : HDC -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t BufferedPaintRenderAnimation(
void* hwnd,
void* hdcTarget);
C, "UXTHEME.dll");
// $ffi->BufferedPaintRenderAnimation(hwnd, hdcTarget);
// hwnd : HWND
// hdcTarget : HDC
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Uxtheme extends StdCallLibrary {
Uxtheme INSTANCE = Native.load("uxtheme", Uxtheme.class);
boolean BufferedPaintRenderAnimation(
Pointer hwnd, // HWND
Pointer hdcTarget // HDC
);
}@[Link("uxtheme")]
lib LibUXTHEME
fun BufferedPaintRenderAnimation = BufferedPaintRenderAnimation(
hwnd : Void*, # HWND
hdcTarget : Void* # HDC
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef BufferedPaintRenderAnimationNative = Int32 Function(Pointer<Void>, Pointer<Void>);
typedef BufferedPaintRenderAnimationDart = int Function(Pointer<Void>, Pointer<Void>);
final BufferedPaintRenderAnimation = DynamicLibrary.open('UXTHEME.dll')
.lookupFunction<BufferedPaintRenderAnimationNative, BufferedPaintRenderAnimationDart>('BufferedPaintRenderAnimation');
// hwnd : HWND -> Pointer<Void>
// hdcTarget : HDC -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function BufferedPaintRenderAnimation(
hwnd: THandle; // HWND
hdcTarget: THandle // HDC
): BOOL; stdcall;
external 'UXTHEME.dll' name 'BufferedPaintRenderAnimation';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "BufferedPaintRenderAnimation"
c_BufferedPaintRenderAnimation :: Ptr () -> Ptr () -> IO CInt
-- hwnd : HWND -> Ptr ()
-- hdcTarget : HDC -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let bufferedpaintrenderanimation =
foreign "BufferedPaintRenderAnimation"
((ptr void) @-> (ptr void) @-> returning int32_t)
(* hwnd : HWND -> (ptr void) *)
(* hdcTarget : HDC -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library uxtheme (t "UXTHEME.dll"))
(cffi:use-foreign-library uxtheme)
(cffi:defcfun ("BufferedPaintRenderAnimation" buffered-paint-render-animation :convention :stdcall) :int32
(hwnd :pointer) ; HWND
(hdc-target :pointer)) ; HDC
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $BufferedPaintRenderAnimation = Win32::API::More->new('UXTHEME',
'BOOL BufferedPaintRenderAnimation(HANDLE hwnd, HANDLE hdcTarget)');
# my $ret = $BufferedPaintRenderAnimation->Call($hwnd, $hdcTarget);
# hwnd : HWND -> HANDLE
# hdcTarget : HDC -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。