ホーム › UI.Controls › GetThemePartSize
GetThemePartSize
関数指定パーツと状態のテーマ要素のサイズを取得する。
シグネチャ
// UXTHEME.dll
#include <windows.h>
HRESULT GetThemePartSize(
HTHEME hTheme,
HDC hdc, // optional
INT iPartId,
INT iStateId,
RECT* prc, // optional
THEMESIZE eSize,
SIZE* psz
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hTheme | HTHEME | in |
| hdc | HDC | inoptional |
| iPartId | INT | in |
| iStateId | INT | in |
| prc | RECT* | inoptional |
| eSize | THEMESIZE | in |
| psz | SIZE* | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// UXTHEME.dll
#include <windows.h>
HRESULT GetThemePartSize(
HTHEME hTheme,
HDC hdc, // optional
INT iPartId,
INT iStateId,
RECT* prc, // optional
THEMESIZE eSize,
SIZE* psz
);[DllImport("UXTHEME.dll", ExactSpelling = true)]
static extern int GetThemePartSize(
IntPtr hTheme, // HTHEME
IntPtr hdc, // HDC optional
int iPartId, // INT
int iStateId, // INT
IntPtr prc, // RECT* optional
int eSize, // THEMESIZE
IntPtr psz // SIZE* out
);<DllImport("UXTHEME.dll", ExactSpelling:=True)>
Public Shared Function GetThemePartSize(
hTheme As IntPtr, ' HTHEME
hdc As IntPtr, ' HDC optional
iPartId As Integer, ' INT
iStateId As Integer, ' INT
prc As IntPtr, ' RECT* optional
eSize As Integer, ' THEMESIZE
psz As IntPtr ' SIZE* out
) As Integer
End Function' hTheme : HTHEME
' hdc : HDC optional
' iPartId : INT
' iStateId : INT
' prc : RECT* optional
' eSize : THEMESIZE
' psz : SIZE* out
Declare PtrSafe Function GetThemePartSize Lib "uxtheme" ( _
ByVal hTheme As LongPtr, _
ByVal hdc As LongPtr, _
ByVal iPartId As Long, _
ByVal iStateId As Long, _
ByVal prc As LongPtr, _
ByVal eSize As Long, _
ByVal psz As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetThemePartSize = ctypes.windll.uxtheme.GetThemePartSize
GetThemePartSize.restype = ctypes.c_int
GetThemePartSize.argtypes = [
ctypes.c_ssize_t, # hTheme : HTHEME
wintypes.HANDLE, # hdc : HDC optional
ctypes.c_int, # iPartId : INT
ctypes.c_int, # iStateId : INT
ctypes.c_void_p, # prc : RECT* optional
ctypes.c_int, # eSize : THEMESIZE
ctypes.c_void_p, # psz : SIZE* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('UXTHEME.dll')
GetThemePartSize = Fiddle::Function.new(
lib['GetThemePartSize'],
[
Fiddle::TYPE_INTPTR_T, # hTheme : HTHEME
Fiddle::TYPE_VOIDP, # hdc : HDC optional
Fiddle::TYPE_INT, # iPartId : INT
Fiddle::TYPE_INT, # iStateId : INT
Fiddle::TYPE_VOIDP, # prc : RECT* optional
Fiddle::TYPE_INT, # eSize : THEMESIZE
Fiddle::TYPE_VOIDP, # psz : SIZE* out
],
Fiddle::TYPE_INT)#[link(name = "uxtheme")]
extern "system" {
fn GetThemePartSize(
hTheme: isize, // HTHEME
hdc: *mut core::ffi::c_void, // HDC optional
iPartId: i32, // INT
iStateId: i32, // INT
prc: *mut RECT, // RECT* optional
eSize: i32, // THEMESIZE
psz: *mut SIZE // SIZE* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("UXTHEME.dll")]
public static extern int GetThemePartSize(IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, IntPtr prc, int eSize, IntPtr psz);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UXTHEME_GetThemePartSize' -Namespace Win32 -PassThru
# $api::GetThemePartSize(hTheme, hdc, iPartId, iStateId, prc, eSize, psz)#uselib "UXTHEME.dll"
#func global GetThemePartSize "GetThemePartSize" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; GetThemePartSize hTheme, hdc, iPartId, iStateId, varptr(prc), eSize, varptr(psz) ; 戻り値は stat
; hTheme : HTHEME -> "sptr"
; hdc : HDC optional -> "sptr"
; iPartId : INT -> "sptr"
; iStateId : INT -> "sptr"
; prc : RECT* optional -> "sptr"
; eSize : THEMESIZE -> "sptr"
; psz : SIZE* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "UXTHEME.dll" #cfunc global GetThemePartSize "GetThemePartSize" sptr, sptr, int, int, var, int, var ; res = GetThemePartSize(hTheme, hdc, iPartId, iStateId, prc, eSize, psz) ; hTheme : HTHEME -> "sptr" ; hdc : HDC optional -> "sptr" ; iPartId : INT -> "int" ; iStateId : INT -> "int" ; prc : RECT* optional -> "var" ; eSize : THEMESIZE -> "int" ; psz : SIZE* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "UXTHEME.dll" #cfunc global GetThemePartSize "GetThemePartSize" sptr, sptr, int, int, sptr, int, sptr ; res = GetThemePartSize(hTheme, hdc, iPartId, iStateId, varptr(prc), eSize, varptr(psz)) ; hTheme : HTHEME -> "sptr" ; hdc : HDC optional -> "sptr" ; iPartId : INT -> "int" ; iStateId : INT -> "int" ; prc : RECT* optional -> "sptr" ; eSize : THEMESIZE -> "int" ; psz : SIZE* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT GetThemePartSize(HTHEME hTheme, HDC hdc, INT iPartId, INT iStateId, RECT* prc, THEMESIZE eSize, SIZE* psz) #uselib "UXTHEME.dll" #cfunc global GetThemePartSize "GetThemePartSize" intptr, intptr, int, int, var, int, var ; res = GetThemePartSize(hTheme, hdc, iPartId, iStateId, prc, eSize, psz) ; hTheme : HTHEME -> "intptr" ; hdc : HDC optional -> "intptr" ; iPartId : INT -> "int" ; iStateId : INT -> "int" ; prc : RECT* optional -> "var" ; eSize : THEMESIZE -> "int" ; psz : SIZE* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT GetThemePartSize(HTHEME hTheme, HDC hdc, INT iPartId, INT iStateId, RECT* prc, THEMESIZE eSize, SIZE* psz) #uselib "UXTHEME.dll" #cfunc global GetThemePartSize "GetThemePartSize" intptr, intptr, int, int, intptr, int, intptr ; res = GetThemePartSize(hTheme, hdc, iPartId, iStateId, varptr(prc), eSize, varptr(psz)) ; hTheme : HTHEME -> "intptr" ; hdc : HDC optional -> "intptr" ; iPartId : INT -> "int" ; iStateId : INT -> "int" ; prc : RECT* optional -> "intptr" ; eSize : THEMESIZE -> "int" ; psz : SIZE* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
uxtheme = windows.NewLazySystemDLL("UXTHEME.dll")
procGetThemePartSize = uxtheme.NewProc("GetThemePartSize")
)
// hTheme (HTHEME), hdc (HDC optional), iPartId (INT), iStateId (INT), prc (RECT* optional), eSize (THEMESIZE), psz (SIZE* out)
r1, _, err := procGetThemePartSize.Call(
uintptr(hTheme),
uintptr(hdc),
uintptr(iPartId),
uintptr(iStateId),
uintptr(prc),
uintptr(eSize),
uintptr(psz),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction GetThemePartSize(
hTheme: NativeInt; // HTHEME
hdc: THandle; // HDC optional
iPartId: Integer; // INT
iStateId: Integer; // INT
prc: Pointer; // RECT* optional
eSize: Integer; // THEMESIZE
psz: Pointer // SIZE* out
): Integer; stdcall;
external 'UXTHEME.dll' name 'GetThemePartSize';result := DllCall("UXTHEME\GetThemePartSize"
, "Ptr", hTheme ; HTHEME
, "Ptr", hdc ; HDC optional
, "Int", iPartId ; INT
, "Int", iStateId ; INT
, "Ptr", prc ; RECT* optional
, "Int", eSize ; THEMESIZE
, "Ptr", psz ; SIZE* out
, "Int") ; return: HRESULT●GetThemePartSize(hTheme, hdc, iPartId, iStateId, prc, eSize, psz) = DLL("UXTHEME.dll", "int GetThemePartSize(int, void*, int, int, void*, int, void*)")
# 呼び出し: GetThemePartSize(hTheme, hdc, iPartId, iStateId, prc, eSize, psz)
# hTheme : HTHEME -> "int"
# hdc : HDC optional -> "void*"
# iPartId : INT -> "int"
# iStateId : INT -> "int"
# prc : RECT* optional -> "void*"
# eSize : THEMESIZE -> "int"
# psz : SIZE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。