Win32 API 日本語リファレンス
ホームUI.Controls › BeginBufferedAnimation

BeginBufferedAnimation

関数
状態間の遷移を補間するバッファアニメーション描画を開始する。
DLLUxTheme.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

// UxTheme.dll
#include <windows.h>

INT_PTR BeginBufferedAnimation(
    HWND hwnd,
    HDC hdcTarget,
    const RECT* prcTarget,
    BP_BUFFERFORMAT dwFormat,
    BP_PAINTPARAMS* pPaintParams,   // optional
    BP_ANIMATIONPARAMS* pAnimationParams,
    HDC* phdcFrom,
    HDC* phdcTo
);

パラメーター

名前方向
hwndHWNDin
hdcTargetHDCin
prcTargetRECT*in
dwFormatBP_BUFFERFORMATin
pPaintParamsBP_PAINTPARAMS*inoptional
pAnimationParamsBP_ANIMATIONPARAMS*in
phdcFromHDC*out
phdcToHDC*out

戻り値の型: INT_PTR

各言語での呼び出し定義

// UxTheme.dll
#include <windows.h>

INT_PTR BeginBufferedAnimation(
    HWND hwnd,
    HDC hdcTarget,
    const RECT* prcTarget,
    BP_BUFFERFORMAT dwFormat,
    BP_PAINTPARAMS* pPaintParams,   // optional
    BP_ANIMATIONPARAMS* pAnimationParams,
    HDC* phdcFrom,
    HDC* phdcTo
);
[DllImport("UxTheme.dll", ExactSpelling = true)]
static extern IntPtr BeginBufferedAnimation(
    IntPtr hwnd,   // HWND
    IntPtr hdcTarget,   // HDC
    IntPtr prcTarget,   // RECT*
    int dwFormat,   // BP_BUFFERFORMAT
    IntPtr pPaintParams,   // BP_PAINTPARAMS* optional
    IntPtr pAnimationParams,   // BP_ANIMATIONPARAMS*
    IntPtr phdcFrom,   // HDC* out
    IntPtr phdcTo   // HDC* out
);
<DllImport("UxTheme.dll", ExactSpelling:=True)>
Public Shared Function BeginBufferedAnimation(
    hwnd As IntPtr,   ' HWND
    hdcTarget As IntPtr,   ' HDC
    prcTarget As IntPtr,   ' RECT*
    dwFormat As Integer,   ' BP_BUFFERFORMAT
    pPaintParams As IntPtr,   ' BP_PAINTPARAMS* optional
    pAnimationParams As IntPtr,   ' BP_ANIMATIONPARAMS*
    phdcFrom As IntPtr,   ' HDC* out
    phdcTo As IntPtr   ' HDC* out
) As IntPtr
End Function
' hwnd : HWND
' hdcTarget : HDC
' prcTarget : RECT*
' dwFormat : BP_BUFFERFORMAT
' pPaintParams : BP_PAINTPARAMS* optional
' pAnimationParams : BP_ANIMATIONPARAMS*
' phdcFrom : HDC* out
' phdcTo : HDC* out
Declare PtrSafe Function BeginBufferedAnimation Lib "uxtheme" ( _
    ByVal hwnd As LongPtr, _
    ByVal hdcTarget As LongPtr, _
    ByVal prcTarget As LongPtr, _
    ByVal dwFormat As Long, _
    ByVal pPaintParams As LongPtr, _
    ByVal pAnimationParams As LongPtr, _
    ByVal phdcFrom As LongPtr, _
    ByVal phdcTo As LongPtr) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

BeginBufferedAnimation = ctypes.windll.uxtheme.BeginBufferedAnimation
BeginBufferedAnimation.restype = ctypes.c_ssize_t
BeginBufferedAnimation.argtypes = [
    wintypes.HANDLE,  # hwnd : HWND
    wintypes.HANDLE,  # hdcTarget : HDC
    ctypes.c_void_p,  # prcTarget : RECT*
    ctypes.c_int,  # dwFormat : BP_BUFFERFORMAT
    ctypes.c_void_p,  # pPaintParams : BP_PAINTPARAMS* optional
    ctypes.c_void_p,  # pAnimationParams : BP_ANIMATIONPARAMS*
    ctypes.c_void_p,  # phdcFrom : HDC* out
    ctypes.c_void_p,  # phdcTo : HDC* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('UxTheme.dll')
BeginBufferedAnimation = Fiddle::Function.new(
  lib['BeginBufferedAnimation'],
  [
    Fiddle::TYPE_VOIDP,  # hwnd : HWND
    Fiddle::TYPE_VOIDP,  # hdcTarget : HDC
    Fiddle::TYPE_VOIDP,  # prcTarget : RECT*
    Fiddle::TYPE_INT,  # dwFormat : BP_BUFFERFORMAT
    Fiddle::TYPE_VOIDP,  # pPaintParams : BP_PAINTPARAMS* optional
    Fiddle::TYPE_VOIDP,  # pAnimationParams : BP_ANIMATIONPARAMS*
    Fiddle::TYPE_VOIDP,  # phdcFrom : HDC* out
    Fiddle::TYPE_VOIDP,  # phdcTo : HDC* out
  ],
  Fiddle::TYPE_INTPTR_T)
#[link(name = "uxtheme")]
extern "system" {
    fn BeginBufferedAnimation(
        hwnd: *mut core::ffi::c_void,  // HWND
        hdcTarget: *mut core::ffi::c_void,  // HDC
        prcTarget: *const RECT,  // RECT*
        dwFormat: i32,  // BP_BUFFERFORMAT
        pPaintParams: *mut BP_PAINTPARAMS,  // BP_PAINTPARAMS* optional
        pAnimationParams: *mut BP_ANIMATIONPARAMS,  // BP_ANIMATIONPARAMS*
        phdcFrom: *mut *mut core::ffi::c_void,  // HDC* out
        phdcTo: *mut *mut core::ffi::c_void  // HDC* out
    ) -> isize;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("UxTheme.dll")]
public static extern IntPtr BeginBufferedAnimation(IntPtr hwnd, IntPtr hdcTarget, IntPtr prcTarget, int dwFormat, IntPtr pPaintParams, IntPtr pAnimationParams, IntPtr phdcFrom, IntPtr phdcTo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UxTheme_BeginBufferedAnimation' -Namespace Win32 -PassThru
# $api::BeginBufferedAnimation(hwnd, hdcTarget, prcTarget, dwFormat, pPaintParams, pAnimationParams, phdcFrom, phdcTo)
#uselib "UxTheme.dll"
#func global BeginBufferedAnimation "BeginBufferedAnimation" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; BeginBufferedAnimation hwnd, hdcTarget, varptr(prcTarget), dwFormat, varptr(pPaintParams), varptr(pAnimationParams), phdcFrom, phdcTo   ; 戻り値は stat
; hwnd : HWND -> "sptr"
; hdcTarget : HDC -> "sptr"
; prcTarget : RECT* -> "sptr"
; dwFormat : BP_BUFFERFORMAT -> "sptr"
; pPaintParams : BP_PAINTPARAMS* optional -> "sptr"
; pAnimationParams : BP_ANIMATIONPARAMS* -> "sptr"
; phdcFrom : HDC* out -> "sptr"
; phdcTo : HDC* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "UxTheme.dll"
#cfunc global BeginBufferedAnimation "BeginBufferedAnimation" sptr, sptr, var, int, var, var, sptr, sptr
; res = BeginBufferedAnimation(hwnd, hdcTarget, prcTarget, dwFormat, pPaintParams, pAnimationParams, phdcFrom, phdcTo)
; hwnd : HWND -> "sptr"
; hdcTarget : HDC -> "sptr"
; prcTarget : RECT* -> "var"
; dwFormat : BP_BUFFERFORMAT -> "int"
; pPaintParams : BP_PAINTPARAMS* optional -> "var"
; pAnimationParams : BP_ANIMATIONPARAMS* -> "var"
; phdcFrom : HDC* out -> "sptr"
; phdcTo : HDC* out -> "sptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT_PTR BeginBufferedAnimation(HWND hwnd, HDC hdcTarget, RECT* prcTarget, BP_BUFFERFORMAT dwFormat, BP_PAINTPARAMS* pPaintParams, BP_ANIMATIONPARAMS* pAnimationParams, HDC* phdcFrom, HDC* phdcTo)
#uselib "UxTheme.dll"
#cfunc global BeginBufferedAnimation "BeginBufferedAnimation" intptr, intptr, var, int, var, var, intptr, intptr
; res = BeginBufferedAnimation(hwnd, hdcTarget, prcTarget, dwFormat, pPaintParams, pAnimationParams, phdcFrom, phdcTo)
; hwnd : HWND -> "intptr"
; hdcTarget : HDC -> "intptr"
; prcTarget : RECT* -> "var"
; dwFormat : BP_BUFFERFORMAT -> "int"
; pPaintParams : BP_PAINTPARAMS* optional -> "var"
; pAnimationParams : BP_ANIMATIONPARAMS* -> "var"
; phdcFrom : HDC* out -> "intptr"
; phdcTo : HDC* out -> "intptr"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	uxtheme = windows.NewLazySystemDLL("UxTheme.dll")
	procBeginBufferedAnimation = uxtheme.NewProc("BeginBufferedAnimation")
)

// hwnd (HWND), hdcTarget (HDC), prcTarget (RECT*), dwFormat (BP_BUFFERFORMAT), pPaintParams (BP_PAINTPARAMS* optional), pAnimationParams (BP_ANIMATIONPARAMS*), phdcFrom (HDC* out), phdcTo (HDC* out)
r1, _, err := procBeginBufferedAnimation.Call(
	uintptr(hwnd),
	uintptr(hdcTarget),
	uintptr(prcTarget),
	uintptr(dwFormat),
	uintptr(pPaintParams),
	uintptr(pAnimationParams),
	uintptr(phdcFrom),
	uintptr(phdcTo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // INT_PTR
function BeginBufferedAnimation(
  hwnd: THandle;   // HWND
  hdcTarget: THandle;   // HDC
  prcTarget: Pointer;   // RECT*
  dwFormat: Integer;   // BP_BUFFERFORMAT
  pPaintParams: Pointer;   // BP_PAINTPARAMS* optional
  pAnimationParams: Pointer;   // BP_ANIMATIONPARAMS*
  phdcFrom: Pointer;   // HDC* out
  phdcTo: Pointer   // HDC* out
): NativeInt; stdcall;
  external 'UxTheme.dll' name 'BeginBufferedAnimation';
result := DllCall("UxTheme\BeginBufferedAnimation"
    , "Ptr", hwnd   ; HWND
    , "Ptr", hdcTarget   ; HDC
    , "Ptr", prcTarget   ; RECT*
    , "Int", dwFormat   ; BP_BUFFERFORMAT
    , "Ptr", pPaintParams   ; BP_PAINTPARAMS* optional
    , "Ptr", pAnimationParams   ; BP_ANIMATIONPARAMS*
    , "Ptr", phdcFrom   ; HDC* out
    , "Ptr", phdcTo   ; HDC* out
    , "Ptr")   ; return: INT_PTR
●BeginBufferedAnimation(hwnd, hdcTarget, prcTarget, dwFormat, pPaintParams, pAnimationParams, phdcFrom, phdcTo) = DLL("UxTheme.dll", "int BeginBufferedAnimation(void*, void*, void*, int, void*, void*, void*, void*)")
# 呼び出し: BeginBufferedAnimation(hwnd, hdcTarget, prcTarget, dwFormat, pPaintParams, pAnimationParams, phdcFrom, phdcTo)
# hwnd : HWND -> "void*"
# hdcTarget : HDC -> "void*"
# prcTarget : RECT* -> "void*"
# dwFormat : BP_BUFFERFORMAT -> "int"
# pPaintParams : BP_PAINTPARAMS* optional -> "void*"
# pAnimationParams : BP_ANIMATIONPARAMS* -> "void*"
# phdcFrom : HDC* out -> "void*"
# phdcTo : HDC* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。