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