Win32 API 日本語リファレンス
ホームUI.Controls › GetThemeBool

GetThemeBool

関数
指定プロパティのテーマ真偽値を取得する。
DLLUxTheme.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT GetThemeBool(
    HTHEME hTheme,
    INT iPartId,
    INT iStateId,
    INT iPropId,
    BOOL* pfVal
);

パラメーター

名前方向
hThemeHTHEMEin
iPartIdINTin
iStateIdINTin
iPropIdINTin
pfValBOOL*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT GetThemeBool(
    HTHEME hTheme,
    INT iPartId,
    INT iStateId,
    INT iPropId,
    BOOL* pfVal
);
[DllImport("UxTheme.dll", ExactSpelling = true)]
static extern int GetThemeBool(
    IntPtr hTheme,   // HTHEME
    int iPartId,   // INT
    int iStateId,   // INT
    int iPropId,   // INT
    out int pfVal   // BOOL* out
);
<DllImport("UxTheme.dll", ExactSpelling:=True)>
Public Shared Function GetThemeBool(
    hTheme As IntPtr,   ' HTHEME
    iPartId As Integer,   ' INT
    iStateId As Integer,   ' INT
    iPropId As Integer,   ' INT
    <Out> ByRef pfVal As Integer   ' BOOL* out
) As Integer
End Function
' hTheme : HTHEME
' iPartId : INT
' iStateId : INT
' iPropId : INT
' pfVal : BOOL* out
Declare PtrSafe Function GetThemeBool Lib "uxtheme" ( _
    ByVal hTheme As LongPtr, _
    ByVal iPartId As Long, _
    ByVal iStateId As Long, _
    ByVal iPropId As Long, _
    ByRef pfVal As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetThemeBool = ctypes.windll.uxtheme.GetThemeBool
GetThemeBool.restype = ctypes.c_int
GetThemeBool.argtypes = [
    ctypes.c_ssize_t,  # hTheme : HTHEME
    ctypes.c_int,  # iPartId : INT
    ctypes.c_int,  # iStateId : INT
    ctypes.c_int,  # iPropId : INT
    ctypes.c_void_p,  # pfVal : BOOL* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('UxTheme.dll')
GetThemeBool = Fiddle::Function.new(
  lib['GetThemeBool'],
  [
    Fiddle::TYPE_INTPTR_T,  # hTheme : HTHEME
    Fiddle::TYPE_INT,  # iPartId : INT
    Fiddle::TYPE_INT,  # iStateId : INT
    Fiddle::TYPE_INT,  # iPropId : INT
    Fiddle::TYPE_VOIDP,  # pfVal : BOOL* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "uxtheme")]
extern "system" {
    fn GetThemeBool(
        hTheme: isize,  // HTHEME
        iPartId: i32,  // INT
        iStateId: i32,  // INT
        iPropId: i32,  // INT
        pfVal: *mut i32  // BOOL* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("UxTheme.dll")]
public static extern int GetThemeBool(IntPtr hTheme, int iPartId, int iStateId, int iPropId, out int pfVal);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UxTheme_GetThemeBool' -Namespace Win32 -PassThru
# $api::GetThemeBool(hTheme, iPartId, iStateId, iPropId, pfVal)
#uselib "UxTheme.dll"
#func global GetThemeBool "GetThemeBool" sptr, sptr, sptr, sptr, sptr
; GetThemeBool hTheme, iPartId, iStateId, iPropId, pfVal   ; 戻り値は stat
; hTheme : HTHEME -> "sptr"
; iPartId : INT -> "sptr"
; iStateId : INT -> "sptr"
; iPropId : INT -> "sptr"
; pfVal : BOOL* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "UxTheme.dll"
#cfunc global GetThemeBool "GetThemeBool" sptr, int, int, int, int
; res = GetThemeBool(hTheme, iPartId, iStateId, iPropId, pfVal)
; hTheme : HTHEME -> "sptr"
; iPartId : INT -> "int"
; iStateId : INT -> "int"
; iPropId : INT -> "int"
; pfVal : BOOL* out -> "int"
; HRESULT GetThemeBool(HTHEME hTheme, INT iPartId, INT iStateId, INT iPropId, BOOL* pfVal)
#uselib "UxTheme.dll"
#cfunc global GetThemeBool "GetThemeBool" intptr, int, int, int, int
; res = GetThemeBool(hTheme, iPartId, iStateId, iPropId, pfVal)
; hTheme : HTHEME -> "intptr"
; iPartId : INT -> "int"
; iStateId : INT -> "int"
; iPropId : INT -> "int"
; pfVal : BOOL* out -> "int"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	uxtheme = windows.NewLazySystemDLL("UxTheme.dll")
	procGetThemeBool = uxtheme.NewProc("GetThemeBool")
)

// hTheme (HTHEME), iPartId (INT), iStateId (INT), iPropId (INT), pfVal (BOOL* out)
r1, _, err := procGetThemeBool.Call(
	uintptr(hTheme),
	uintptr(iPartId),
	uintptr(iStateId),
	uintptr(iPropId),
	uintptr(pfVal),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function GetThemeBool(
  hTheme: NativeInt;   // HTHEME
  iPartId: Integer;   // INT
  iStateId: Integer;   // INT
  iPropId: Integer;   // INT
  pfVal: Pointer   // BOOL* out
): Integer; stdcall;
  external 'UxTheme.dll' name 'GetThemeBool';
result := DllCall("UxTheme\GetThemeBool"
    , "Ptr", hTheme   ; HTHEME
    , "Int", iPartId   ; INT
    , "Int", iStateId   ; INT
    , "Int", iPropId   ; INT
    , "Ptr", pfVal   ; BOOL* out
    , "Int")   ; return: HRESULT
●GetThemeBool(hTheme, iPartId, iStateId, iPropId, pfVal) = DLL("UxTheme.dll", "int GetThemeBool(int, int, int, int, void*)")
# 呼び出し: GetThemeBool(hTheme, iPartId, iStateId, iPropId, pfVal)
# hTheme : HTHEME -> "int"
# iPartId : INT -> "int"
# iStateId : INT -> "int"
# iPropId : INT -> "int"
# pfVal : BOOL* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。