Win32 API 日本語リファレンス
ホームGraphics.Gdi › DrawAnimatedRects

DrawAnimatedRects

関数
矩形が移動するアニメーション効果を描画する。
DLLUSER32.dll呼出規約winapi対応OSWindows 2000 以降

シグネチャ

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

BOOL DrawAnimatedRects(
    HWND hwnd,   // optional
    INT idAni,
    const RECT* lprcFrom,
    const RECT* lprcTo
);

パラメーター

名前方向説明
hwndHWNDinoptional画面上でキャプションをアニメーション表示するウィンドウへのハンドル。アニメーションはこのウィンドウの親によってクリップされます。
idAniINTinアニメーションの種類。これは IDANI_CAPTION でなければなりません。IDANI_CAPTION アニメーションの種類では、ウィンドウのキャプションが lprcFrom で指定された位置から lprcTo で指定された位置へアニメーションします。この効果はウィンドウの最小化や最大化に似ています。
lprcFromRECT*inアイコンまたは最小化されたウィンドウの位置とサイズを指定する RECT 構造体へのポインター。座標はクリッピングウィンドウ hwnd を基準とします。
lprcToRECT*in復元されたウィンドウの位置とサイズを指定する RECT 構造体へのポインター。座標はクリッピングウィンドウ hwnd を基準とします。

戻り値の型: BOOL

公式ドキュメント

ウィンドウのキャプションをアニメーション表示し、アイコンを開く動作、またはウィンドウの最小化や最大化を示します。

戻り値

関数が成功した場合、戻り値は 0 以外の値です。

関数が失敗した場合、戻り値は 0 です。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

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

BOOL DrawAnimatedRects(
    HWND hwnd,   // optional
    INT idAni,
    const RECT* lprcFrom,
    const RECT* lprcTo
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll", ExactSpelling = true)]
static extern bool DrawAnimatedRects(
    IntPtr hwnd,   // HWND optional
    int idAni,   // INT
    IntPtr lprcFrom,   // RECT*
    IntPtr lprcTo   // RECT*
);
<DllImport("USER32.dll", ExactSpelling:=True)>
Public Shared Function DrawAnimatedRects(
    hwnd As IntPtr,   ' HWND optional
    idAni As Integer,   ' INT
    lprcFrom As IntPtr,   ' RECT*
    lprcTo As IntPtr   ' RECT*
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' hwnd : HWND optional
' idAni : INT
' lprcFrom : RECT*
' lprcTo : RECT*
Declare PtrSafe Function DrawAnimatedRects Lib "user32" ( _
    ByVal hwnd As LongPtr, _
    ByVal idAni As Long, _
    ByVal lprcFrom As LongPtr, _
    ByVal lprcTo As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

DrawAnimatedRects = ctypes.windll.user32.DrawAnimatedRects
DrawAnimatedRects.restype = wintypes.BOOL
DrawAnimatedRects.argtypes = [
    wintypes.HANDLE,  # hwnd : HWND optional
    ctypes.c_int,  # idAni : INT
    ctypes.c_void_p,  # lprcFrom : RECT*
    ctypes.c_void_p,  # lprcTo : RECT*
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('USER32.dll')
DrawAnimatedRects = Fiddle::Function.new(
  lib['DrawAnimatedRects'],
  [
    Fiddle::TYPE_VOIDP,  # hwnd : HWND optional
    Fiddle::TYPE_INT,  # idAni : INT
    Fiddle::TYPE_VOIDP,  # lprcFrom : RECT*
    Fiddle::TYPE_VOIDP,  # lprcTo : RECT*
  ],
  Fiddle::TYPE_INT)
#[link(name = "user32")]
extern "system" {
    fn DrawAnimatedRects(
        hwnd: *mut core::ffi::c_void,  // HWND optional
        idAni: i32,  // INT
        lprcFrom: *const RECT,  // RECT*
        lprcTo: *const RECT  // RECT*
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("USER32.dll")]
public static extern bool DrawAnimatedRects(IntPtr hwnd, int idAni, IntPtr lprcFrom, IntPtr lprcTo);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USER32_DrawAnimatedRects' -Namespace Win32 -PassThru
# $api::DrawAnimatedRects(hwnd, idAni, lprcFrom, lprcTo)
#uselib "USER32.dll"
#func global DrawAnimatedRects "DrawAnimatedRects" sptr, sptr, sptr, sptr
; DrawAnimatedRects hwnd, idAni, varptr(lprcFrom), varptr(lprcTo)   ; 戻り値は stat
; hwnd : HWND optional -> "sptr"
; idAni : INT -> "sptr"
; lprcFrom : RECT* -> "sptr"
; lprcTo : RECT* -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "USER32.dll"
#cfunc global DrawAnimatedRects "DrawAnimatedRects" sptr, int, var, var
; res = DrawAnimatedRects(hwnd, idAni, lprcFrom, lprcTo)
; hwnd : HWND optional -> "sptr"
; idAni : INT -> "int"
; lprcFrom : RECT* -> "var"
; lprcTo : RECT* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; BOOL DrawAnimatedRects(HWND hwnd, INT idAni, RECT* lprcFrom, RECT* lprcTo)
#uselib "USER32.dll"
#cfunc global DrawAnimatedRects "DrawAnimatedRects" intptr, int, var, var
; res = DrawAnimatedRects(hwnd, idAni, lprcFrom, lprcTo)
; hwnd : HWND optional -> "intptr"
; idAni : INT -> "int"
; lprcFrom : RECT* -> "var"
; lprcTo : RECT* -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	user32 = windows.NewLazySystemDLL("USER32.dll")
	procDrawAnimatedRects = user32.NewProc("DrawAnimatedRects")
)

// hwnd (HWND optional), idAni (INT), lprcFrom (RECT*), lprcTo (RECT*)
r1, _, err := procDrawAnimatedRects.Call(
	uintptr(hwnd),
	uintptr(idAni),
	uintptr(lprcFrom),
	uintptr(lprcTo),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // BOOL
function DrawAnimatedRects(
  hwnd: THandle;   // HWND optional
  idAni: Integer;   // INT
  lprcFrom: Pointer;   // RECT*
  lprcTo: Pointer   // RECT*
): BOOL; stdcall;
  external 'USER32.dll' name 'DrawAnimatedRects';
result := DllCall("USER32\DrawAnimatedRects"
    , "Ptr", hwnd   ; HWND optional
    , "Int", idAni   ; INT
    , "Ptr", lprcFrom   ; RECT*
    , "Ptr", lprcTo   ; RECT*
    , "Int")   ; return: BOOL
●DrawAnimatedRects(hwnd, idAni, lprcFrom, lprcTo) = DLL("USER32.dll", "bool DrawAnimatedRects(void*, int, void*, void*)")
# 呼び出し: DrawAnimatedRects(hwnd, idAni, lprcFrom, lprcTo)
# hwnd : HWND optional -> "void*"
# idAni : INT -> "int"
# lprcFrom : RECT* -> "void*"
# lprcTo : RECT* -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
const std = @import("std");

extern "user32" fn DrawAnimatedRects(
    hwnd: ?*anyopaque, // HWND optional
    idAni: i32, // INT
    lprcFrom: [*c]RECT, // RECT*
    lprcTo: [*c]RECT // RECT*
) callconv(std.os.windows.WINAPI) i32;
proc DrawAnimatedRects(
    hwnd: pointer,  # HWND optional
    idAni: int32,  # INT
    lprcFrom: ptr RECT,  # RECT*
    lprcTo: ptr RECT  # RECT*
): int32 {.importc: "DrawAnimatedRects", stdcall, dynlib: "USER32.dll".}
pragma(lib, "user32");
extern(Windows)
int DrawAnimatedRects(
    void* hwnd,   // HWND optional
    int idAni,   // INT
    RECT* lprcFrom,   // RECT*
    RECT* lprcTo   // RECT*
);
ccall((:DrawAnimatedRects, "USER32.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Int32, Ptr{RECT}, Ptr{RECT}),
      hwnd, idAni, lprcFrom, lprcTo)
# hwnd : HWND optional -> Ptr{Cvoid}
# idAni : INT -> Int32
# lprcFrom : RECT* -> Ptr{RECT}
# lprcTo : RECT* -> Ptr{RECT}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t DrawAnimatedRects(
    void* hwnd,
    int32_t idAni,
    void* lprcFrom,
    void* lprcTo);
]]
local user32 = ffi.load("user32")
-- user32.DrawAnimatedRects(hwnd, idAni, lprcFrom, lprcTo)
-- hwnd : HWND optional
-- idAni : INT
-- lprcFrom : RECT*
-- lprcTo : RECT*
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('USER32.dll');
const DrawAnimatedRects = lib.func('__stdcall', 'DrawAnimatedRects', 'int32_t', ['void *', 'int32_t', 'void *', 'void *']);
// DrawAnimatedRects(hwnd, idAni, lprcFrom, lprcTo)
// hwnd : HWND optional -> 'void *'
// idAni : INT -> 'int32_t'
// lprcFrom : RECT* -> 'void *'
// lprcTo : RECT* -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("USER32.dll", {
  DrawAnimatedRects: { parameters: ["pointer", "i32", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.DrawAnimatedRects(hwnd, idAni, lprcFrom, lprcTo)
// hwnd : HWND optional -> "pointer"
// idAni : INT -> "i32"
// lprcFrom : RECT* -> "pointer"
// lprcTo : RECT* -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t DrawAnimatedRects(
    void* hwnd,
    int32_t idAni,
    void* lprcFrom,
    void* lprcTo);
C, "USER32.dll");
// $ffi->DrawAnimatedRects(hwnd, idAni, lprcFrom, lprcTo);
// hwnd : HWND optional
// idAni : INT
// lprcFrom : RECT*
// lprcTo : RECT*
// 構造体/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 User32 extends StdCallLibrary {
    User32 INSTANCE = Native.load("user32", User32.class);
    boolean DrawAnimatedRects(
        Pointer hwnd,   // HWND optional
        int idAni,   // INT
        Pointer lprcFrom,   // RECT*
        Pointer lprcTo   // RECT*
    );
}
@[Link("user32")]
lib LibUSER32
  fun DrawAnimatedRects = DrawAnimatedRects(
    hwnd : Void*,   # HWND optional
    idAni : Int32,   # INT
    lprcFrom : RECT*,   # RECT*
    lprcTo : RECT*   # RECT*
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef DrawAnimatedRectsNative = Int32 Function(Pointer<Void>, Int32, Pointer<Void>, Pointer<Void>);
typedef DrawAnimatedRectsDart = int Function(Pointer<Void>, int, Pointer<Void>, Pointer<Void>);
final DrawAnimatedRects = DynamicLibrary.open('USER32.dll')
    .lookupFunction<DrawAnimatedRectsNative, DrawAnimatedRectsDart>('DrawAnimatedRects');
// hwnd : HWND optional -> Pointer<Void>
// idAni : INT -> Int32
// lprcFrom : RECT* -> Pointer<Void>
// lprcTo : RECT* -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function DrawAnimatedRects(
  hwnd: THandle;   // HWND optional
  idAni: Integer;   // INT
  lprcFrom: Pointer;   // RECT*
  lprcTo: Pointer   // RECT*
): BOOL; stdcall;
  external 'USER32.dll' name 'DrawAnimatedRects';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "DrawAnimatedRects"
  c_DrawAnimatedRects :: Ptr () -> Int32 -> Ptr () -> Ptr () -> IO CInt
-- hwnd : HWND optional -> Ptr ()
-- idAni : INT -> Int32
-- lprcFrom : RECT* -> Ptr ()
-- lprcTo : RECT* -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let drawanimatedrects =
  foreign "DrawAnimatedRects"
    ((ptr void) @-> int32_t @-> (ptr void) @-> (ptr void) @-> returning int32_t)
(* hwnd : HWND optional -> (ptr void) *)
(* idAni : INT -> int32_t *)
(* lprcFrom : RECT* -> (ptr void) *)
(* lprcTo : RECT* -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library user32 (t "USER32.dll"))
(cffi:use-foreign-library user32)

(cffi:defcfun ("DrawAnimatedRects" draw-animated-rects :convention :stdcall) :int32
  (hwnd :pointer)   ; HWND optional
  (id-ani :int32)   ; INT
  (lprc-from :pointer)   ; RECT*
  (lprc-to :pointer))   ; RECT*
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $DrawAnimatedRects = Win32::API::More->new('USER32',
    'BOOL DrawAnimatedRects(HANDLE hwnd, int idAni, LPVOID lprcFrom, LPVOID lprcTo)');
# my $ret = $DrawAnimatedRects->Call($hwnd, $idAni, $lprcFrom, $lprcTo);
# hwnd : HWND optional -> HANDLE
# idAni : INT -> int
# lprcFrom : RECT* -> LPVOID
# lprcTo : RECT* -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型