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

GetThemeSysInt

関数
テーマで定義されたシステム整数値を取得する。
DLLUxTheme.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT GetThemeSysInt(
    HTHEME hTheme,
    INT iIntId,
    INT* piValue
);

パラメーター

名前方向
hThemeHTHEMEin
iIntIdINTin
piValueINT*out

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

GetThemeSysInt = ctypes.windll.uxtheme.GetThemeSysInt
GetThemeSysInt.restype = ctypes.c_int
GetThemeSysInt.argtypes = [
    ctypes.c_ssize_t,  # hTheme : HTHEME
    ctypes.c_int,  # iIntId : INT
    ctypes.POINTER(ctypes.c_int),  # piValue : INT* out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('UxTheme.dll')
GetThemeSysInt = Fiddle::Function.new(
  lib['GetThemeSysInt'],
  [
    Fiddle::TYPE_INTPTR_T,  # hTheme : HTHEME
    Fiddle::TYPE_INT,  # iIntId : INT
    Fiddle::TYPE_VOIDP,  # piValue : INT* out
  ],
  Fiddle::TYPE_INT)
#[link(name = "uxtheme")]
extern "system" {
    fn GetThemeSysInt(
        hTheme: isize,  // HTHEME
        iIntId: i32,  // INT
        piValue: *mut i32  // INT* out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("UxTheme.dll")]
public static extern int GetThemeSysInt(IntPtr hTheme, int iIntId, out int piValue);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UxTheme_GetThemeSysInt' -Namespace Win32 -PassThru
# $api::GetThemeSysInt(hTheme, iIntId, piValue)
#uselib "UxTheme.dll"
#func global GetThemeSysInt "GetThemeSysInt" sptr, sptr, sptr
; GetThemeSysInt hTheme, iIntId, varptr(piValue)   ; 戻り値は stat
; hTheme : HTHEME -> "sptr"
; iIntId : INT -> "sptr"
; piValue : INT* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "UxTheme.dll"
#cfunc global GetThemeSysInt "GetThemeSysInt" sptr, int, var
; res = GetThemeSysInt(hTheme, iIntId, piValue)
; hTheme : HTHEME -> "sptr"
; iIntId : INT -> "int"
; piValue : INT* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT GetThemeSysInt(HTHEME hTheme, INT iIntId, INT* piValue)
#uselib "UxTheme.dll"
#cfunc global GetThemeSysInt "GetThemeSysInt" intptr, int, var
; res = GetThemeSysInt(hTheme, iIntId, piValue)
; hTheme : HTHEME -> "intptr"
; iIntId : INT -> "int"
; piValue : INT* out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	uxtheme = windows.NewLazySystemDLL("UxTheme.dll")
	procGetThemeSysInt = uxtheme.NewProc("GetThemeSysInt")
)

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