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