ホーム › UI.Controls › GetThemeTransitionDuration
GetThemeTransitionDuration
関数状態間のテーマ遷移アニメーションの所要時間を取得する。
シグネチャ
// UXTHEME.dll
#include <windows.h>
HRESULT GetThemeTransitionDuration(
HTHEME hTheme,
INT iPartId,
INT iStateIdFrom,
INT iStateIdTo,
INT iPropId,
DWORD* pdwDuration
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hTheme | HTHEME | in | テーマデータのハンドル。 |
| iPartId | INT | in | パーツの ID。 |
| iStateIdFrom | INT | in | トランジション前のパーツの状態 ID。 |
| iStateIdTo | INT | in | トランジション後のパーツの状態 ID。 |
| iPropId | INT | in | プロパティ ID。 |
| pdwDuration | DWORD* | out | トランジションの継続時間 (ミリ秒単位) を受け取る変数のアドレス。 |
戻り値の型: HRESULT
公式ドキュメント
指定されたトランジションの継続時間を取得します。
戻り値
出典・ライセンス: 上記「公式ドキュメント」の内容は 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>
HRESULT GetThemeTransitionDuration(
HTHEME hTheme,
INT iPartId,
INT iStateIdFrom,
INT iStateIdTo,
INT iPropId,
DWORD* pdwDuration
);[DllImport("UXTHEME.dll", ExactSpelling = true)]
static extern int GetThemeTransitionDuration(
IntPtr hTheme, // HTHEME
int iPartId, // INT
int iStateIdFrom, // INT
int iStateIdTo, // INT
int iPropId, // INT
out uint pdwDuration // DWORD* out
);<DllImport("UXTHEME.dll", ExactSpelling:=True)>
Public Shared Function GetThemeTransitionDuration(
hTheme As IntPtr, ' HTHEME
iPartId As Integer, ' INT
iStateIdFrom As Integer, ' INT
iStateIdTo As Integer, ' INT
iPropId As Integer, ' INT
<Out> ByRef pdwDuration As UInteger ' DWORD* out
) As Integer
End Function' hTheme : HTHEME
' iPartId : INT
' iStateIdFrom : INT
' iStateIdTo : INT
' iPropId : INT
' pdwDuration : DWORD* out
Declare PtrSafe Function GetThemeTransitionDuration Lib "uxtheme" ( _
ByVal hTheme As LongPtr, _
ByVal iPartId As Long, _
ByVal iStateIdFrom As Long, _
ByVal iStateIdTo As Long, _
ByVal iPropId As Long, _
ByRef pdwDuration As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetThemeTransitionDuration = ctypes.windll.uxtheme.GetThemeTransitionDuration
GetThemeTransitionDuration.restype = ctypes.c_int
GetThemeTransitionDuration.argtypes = [
ctypes.c_ssize_t, # hTheme : HTHEME
ctypes.c_int, # iPartId : INT
ctypes.c_int, # iStateIdFrom : INT
ctypes.c_int, # iStateIdTo : INT
ctypes.c_int, # iPropId : INT
ctypes.POINTER(wintypes.DWORD), # pdwDuration : DWORD* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('UXTHEME.dll')
GetThemeTransitionDuration = Fiddle::Function.new(
lib['GetThemeTransitionDuration'],
[
Fiddle::TYPE_INTPTR_T, # hTheme : HTHEME
Fiddle::TYPE_INT, # iPartId : INT
Fiddle::TYPE_INT, # iStateIdFrom : INT
Fiddle::TYPE_INT, # iStateIdTo : INT
Fiddle::TYPE_INT, # iPropId : INT
Fiddle::TYPE_VOIDP, # pdwDuration : DWORD* out
],
Fiddle::TYPE_INT)#[link(name = "uxtheme")]
extern "system" {
fn GetThemeTransitionDuration(
hTheme: isize, // HTHEME
iPartId: i32, // INT
iStateIdFrom: i32, // INT
iStateIdTo: i32, // INT
iPropId: i32, // INT
pdwDuration: *mut u32 // DWORD* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("UXTHEME.dll")]
public static extern int GetThemeTransitionDuration(IntPtr hTheme, int iPartId, int iStateIdFrom, int iStateIdTo, int iPropId, out uint pdwDuration);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UXTHEME_GetThemeTransitionDuration' -Namespace Win32 -PassThru
# $api::GetThemeTransitionDuration(hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId, pdwDuration)#uselib "UXTHEME.dll"
#func global GetThemeTransitionDuration "GetThemeTransitionDuration" sptr, sptr, sptr, sptr, sptr, sptr
; GetThemeTransitionDuration hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId, varptr(pdwDuration) ; 戻り値は stat
; hTheme : HTHEME -> "sptr"
; iPartId : INT -> "sptr"
; iStateIdFrom : INT -> "sptr"
; iStateIdTo : INT -> "sptr"
; iPropId : INT -> "sptr"
; pdwDuration : DWORD* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "UXTHEME.dll" #cfunc global GetThemeTransitionDuration "GetThemeTransitionDuration" sptr, int, int, int, int, var ; res = GetThemeTransitionDuration(hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId, pdwDuration) ; hTheme : HTHEME -> "sptr" ; iPartId : INT -> "int" ; iStateIdFrom : INT -> "int" ; iStateIdTo : INT -> "int" ; iPropId : INT -> "int" ; pdwDuration : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "UXTHEME.dll" #cfunc global GetThemeTransitionDuration "GetThemeTransitionDuration" sptr, int, int, int, int, sptr ; res = GetThemeTransitionDuration(hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId, varptr(pdwDuration)) ; hTheme : HTHEME -> "sptr" ; iPartId : INT -> "int" ; iStateIdFrom : INT -> "int" ; iStateIdTo : INT -> "int" ; iPropId : INT -> "int" ; pdwDuration : DWORD* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT GetThemeTransitionDuration(HTHEME hTheme, INT iPartId, INT iStateIdFrom, INT iStateIdTo, INT iPropId, DWORD* pdwDuration) #uselib "UXTHEME.dll" #cfunc global GetThemeTransitionDuration "GetThemeTransitionDuration" intptr, int, int, int, int, var ; res = GetThemeTransitionDuration(hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId, pdwDuration) ; hTheme : HTHEME -> "intptr" ; iPartId : INT -> "int" ; iStateIdFrom : INT -> "int" ; iStateIdTo : INT -> "int" ; iPropId : INT -> "int" ; pdwDuration : DWORD* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT GetThemeTransitionDuration(HTHEME hTheme, INT iPartId, INT iStateIdFrom, INT iStateIdTo, INT iPropId, DWORD* pdwDuration) #uselib "UXTHEME.dll" #cfunc global GetThemeTransitionDuration "GetThemeTransitionDuration" intptr, int, int, int, int, intptr ; res = GetThemeTransitionDuration(hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId, varptr(pdwDuration)) ; hTheme : HTHEME -> "intptr" ; iPartId : INT -> "int" ; iStateIdFrom : INT -> "int" ; iStateIdTo : INT -> "int" ; iPropId : INT -> "int" ; pdwDuration : DWORD* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
uxtheme = windows.NewLazySystemDLL("UXTHEME.dll")
procGetThemeTransitionDuration = uxtheme.NewProc("GetThemeTransitionDuration")
)
// hTheme (HTHEME), iPartId (INT), iStateIdFrom (INT), iStateIdTo (INT), iPropId (INT), pdwDuration (DWORD* out)
r1, _, err := procGetThemeTransitionDuration.Call(
uintptr(hTheme),
uintptr(iPartId),
uintptr(iStateIdFrom),
uintptr(iStateIdTo),
uintptr(iPropId),
uintptr(pdwDuration),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction GetThemeTransitionDuration(
hTheme: NativeInt; // HTHEME
iPartId: Integer; // INT
iStateIdFrom: Integer; // INT
iStateIdTo: Integer; // INT
iPropId: Integer; // INT
pdwDuration: Pointer // DWORD* out
): Integer; stdcall;
external 'UXTHEME.dll' name 'GetThemeTransitionDuration';result := DllCall("UXTHEME\GetThemeTransitionDuration"
, "Ptr", hTheme ; HTHEME
, "Int", iPartId ; INT
, "Int", iStateIdFrom ; INT
, "Int", iStateIdTo ; INT
, "Int", iPropId ; INT
, "Ptr", pdwDuration ; DWORD* out
, "Int") ; return: HRESULT●GetThemeTransitionDuration(hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId, pdwDuration) = DLL("UXTHEME.dll", "int GetThemeTransitionDuration(int, int, int, int, int, void*)")
# 呼び出し: GetThemeTransitionDuration(hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId, pdwDuration)
# hTheme : HTHEME -> "int"
# iPartId : INT -> "int"
# iStateIdFrom : INT -> "int"
# iStateIdTo : INT -> "int"
# iPropId : INT -> "int"
# pdwDuration : DWORD* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "uxtheme" fn GetThemeTransitionDuration(
hTheme: isize, // HTHEME
iPartId: i32, // INT
iStateIdFrom: i32, // INT
iStateIdTo: i32, // INT
iPropId: i32, // INT
pdwDuration: [*c]u32 // DWORD* out
) callconv(std.os.windows.WINAPI) i32;proc GetThemeTransitionDuration(
hTheme: int, # HTHEME
iPartId: int32, # INT
iStateIdFrom: int32, # INT
iStateIdTo: int32, # INT
iPropId: int32, # INT
pdwDuration: ptr uint32 # DWORD* out
): int32 {.importc: "GetThemeTransitionDuration", stdcall, dynlib: "UXTHEME.dll".}pragma(lib, "uxtheme");
extern(Windows)
int GetThemeTransitionDuration(
ptrdiff_t hTheme, // HTHEME
int iPartId, // INT
int iStateIdFrom, // INT
int iStateIdTo, // INT
int iPropId, // INT
uint* pdwDuration // DWORD* out
);ccall((:GetThemeTransitionDuration, "UXTHEME.dll"), stdcall, Int32,
(Int, Int32, Int32, Int32, Int32, Ptr{UInt32}),
hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId, pdwDuration)
# hTheme : HTHEME -> Int
# iPartId : INT -> Int32
# iStateIdFrom : INT -> Int32
# iStateIdTo : INT -> Int32
# iPropId : INT -> Int32
# pdwDuration : DWORD* out -> Ptr{UInt32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GetThemeTransitionDuration(
intptr_t hTheme,
int32_t iPartId,
int32_t iStateIdFrom,
int32_t iStateIdTo,
int32_t iPropId,
uint32_t* pdwDuration);
]]
local uxtheme = ffi.load("uxtheme")
-- uxtheme.GetThemeTransitionDuration(hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId, pdwDuration)
-- hTheme : HTHEME
-- iPartId : INT
-- iStateIdFrom : INT
-- iStateIdTo : INT
-- iPropId : INT
-- pdwDuration : DWORD* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('UXTHEME.dll');
const GetThemeTransitionDuration = lib.func('__stdcall', 'GetThemeTransitionDuration', 'int32_t', ['intptr_t', 'int32_t', 'int32_t', 'int32_t', 'int32_t', 'uint32_t *']);
// GetThemeTransitionDuration(hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId, pdwDuration)
// hTheme : HTHEME -> 'intptr_t'
// iPartId : INT -> 'int32_t'
// iStateIdFrom : INT -> 'int32_t'
// iStateIdTo : INT -> 'int32_t'
// iPropId : INT -> 'int32_t'
// pdwDuration : DWORD* out -> 'uint32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("UXTHEME.dll", {
GetThemeTransitionDuration: { parameters: ["isize", "i32", "i32", "i32", "i32", "pointer"], result: "i32" },
});
// lib.symbols.GetThemeTransitionDuration(hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId, pdwDuration)
// hTheme : HTHEME -> "isize"
// iPartId : INT -> "i32"
// iStateIdFrom : INT -> "i32"
// iStateIdTo : INT -> "i32"
// iPropId : INT -> "i32"
// pdwDuration : DWORD* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GetThemeTransitionDuration(
intptr_t hTheme,
int32_t iPartId,
int32_t iStateIdFrom,
int32_t iStateIdTo,
int32_t iPropId,
uint32_t* pdwDuration);
C, "UXTHEME.dll");
// $ffi->GetThemeTransitionDuration(hTheme, iPartId, iStateIdFrom, iStateIdTo, iPropId, pdwDuration);
// hTheme : HTHEME
// iPartId : INT
// iStateIdFrom : INT
// iStateIdTo : INT
// iPropId : INT
// pdwDuration : DWORD* out
// 構造体/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);
int GetThemeTransitionDuration(
long hTheme, // HTHEME
int iPartId, // INT
int iStateIdFrom, // INT
int iStateIdTo, // INT
int iPropId, // INT
IntByReference pdwDuration // DWORD* out
);
}@[Link("uxtheme")]
lib LibUXTHEME
fun GetThemeTransitionDuration = GetThemeTransitionDuration(
hTheme : LibC::SSizeT, # HTHEME
iPartId : Int32, # INT
iStateIdFrom : Int32, # INT
iStateIdTo : Int32, # INT
iPropId : Int32, # INT
pdwDuration : UInt32* # DWORD* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef GetThemeTransitionDurationNative = Int32 Function(IntPtr, Int32, Int32, Int32, Int32, Pointer<Uint32>);
typedef GetThemeTransitionDurationDart = int Function(int, int, int, int, int, Pointer<Uint32>);
final GetThemeTransitionDuration = DynamicLibrary.open('UXTHEME.dll')
.lookupFunction<GetThemeTransitionDurationNative, GetThemeTransitionDurationDart>('GetThemeTransitionDuration');
// hTheme : HTHEME -> IntPtr
// iPartId : INT -> Int32
// iStateIdFrom : INT -> Int32
// iStateIdTo : INT -> Int32
// iPropId : INT -> Int32
// pdwDuration : DWORD* out -> Pointer<Uint32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GetThemeTransitionDuration(
hTheme: NativeInt; // HTHEME
iPartId: Integer; // INT
iStateIdFrom: Integer; // INT
iStateIdTo: Integer; // INT
iPropId: Integer; // INT
pdwDuration: Pointer // DWORD* out
): Integer; stdcall;
external 'UXTHEME.dll' name 'GetThemeTransitionDuration';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GetThemeTransitionDuration"
c_GetThemeTransitionDuration :: CIntPtr -> Int32 -> Int32 -> Int32 -> Int32 -> Ptr Word32 -> IO Int32
-- hTheme : HTHEME -> CIntPtr
-- iPartId : INT -> Int32
-- iStateIdFrom : INT -> Int32
-- iStateIdTo : INT -> Int32
-- iPropId : INT -> Int32
-- pdwDuration : DWORD* out -> Ptr Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let getthemetransitionduration =
foreign "GetThemeTransitionDuration"
(intptr_t @-> int32_t @-> int32_t @-> int32_t @-> int32_t @-> (ptr uint32_t) @-> returning int32_t)
(* hTheme : HTHEME -> intptr_t *)
(* iPartId : INT -> int32_t *)
(* iStateIdFrom : INT -> int32_t *)
(* iStateIdTo : INT -> int32_t *)
(* iPropId : INT -> int32_t *)
(* pdwDuration : DWORD* out -> (ptr uint32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library uxtheme (t "UXTHEME.dll"))
(cffi:use-foreign-library uxtheme)
(cffi:defcfun ("GetThemeTransitionDuration" get-theme-transition-duration :convention :stdcall) :int32
(h-theme :int64) ; HTHEME
(i-part-id :int32) ; INT
(i-state-id-from :int32) ; INT
(i-state-id-to :int32) ; INT
(i-prop-id :int32) ; INT
(pdw-duration :pointer)) ; DWORD* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GetThemeTransitionDuration = Win32::API::More->new('UXTHEME',
'int GetThemeTransitionDuration(LPARAM hTheme, int iPartId, int iStateIdFrom, int iStateIdTo, int iPropId, LPVOID pdwDuration)');
# my $ret = $GetThemeTransitionDuration->Call($hTheme, $iPartId, $iStateIdFrom, $iStateIdTo, $iPropId, $pdwDuration);
# hTheme : HTHEME -> LPARAM
# iPartId : INT -> int
# iStateIdFrom : INT -> int
# iStateIdTo : INT -> int
# iPropId : INT -> int
# pdwDuration : DWORD* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。