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

取得したいシステムの int を指定する int 型の値。次の値を指定できます。

意味
TMT_MINCOLORDEPTH
このスタイルを正しく表示するために必要な最小の色深度(ビット単位)。
piValueINT*outシステムの整数値を受け取る int へのポインター。

戻り値の型: HRESULT

公式ドキュメント

システムの int 値を取得します。

戻り値

型: HRESULT

この関数が成功した場合は S_OK を返します。それ以外の場合は HRESULT エラーコードを返します。

出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)

各言語での呼び出し定義

// 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)。
const std = @import("std");

extern "uxtheme" fn GetThemeSysInt(
    hTheme: isize, // HTHEME
    iIntId: i32, // INT
    piValue: [*c]i32 // INT* out
) callconv(std.os.windows.WINAPI) i32;
proc GetThemeSysInt(
    hTheme: int,  # HTHEME
    iIntId: int32,  # INT
    piValue: ptr int32  # INT* out
): int32 {.importc: "GetThemeSysInt", stdcall, dynlib: "UXTHEME.dll".}
pragma(lib, "uxtheme");
extern(Windows)
int GetThemeSysInt(
    ptrdiff_t hTheme,   // HTHEME
    int iIntId,   // INT
    int* piValue   // INT* out
);
ccall((:GetThemeSysInt, "UXTHEME.dll"), stdcall, Int32,
      (Int, Int32, Ptr{Int32}),
      hTheme, iIntId, piValue)
# hTheme : HTHEME -> Int
# iIntId : INT -> Int32
# piValue : INT* out -> Ptr{Int32}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t GetThemeSysInt(
    intptr_t hTheme,
    int32_t iIntId,
    int32_t* piValue);
]]
local uxtheme = ffi.load("uxtheme")
-- uxtheme.GetThemeSysInt(hTheme, iIntId, piValue)
-- hTheme : HTHEME
-- iIntId : INT
-- piValue : INT* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('UXTHEME.dll');
const GetThemeSysInt = lib.func('__stdcall', 'GetThemeSysInt', 'int32_t', ['intptr_t', 'int32_t', 'int32_t *']);
// GetThemeSysInt(hTheme, iIntId, piValue)
// hTheme : HTHEME -> 'intptr_t'
// iIntId : INT -> 'int32_t'
// piValue : INT* out -> 'int32_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("UXTHEME.dll", {
  GetThemeSysInt: { parameters: ["isize", "i32", "pointer"], result: "i32" },
});
// lib.symbols.GetThemeSysInt(hTheme, iIntId, piValue)
// hTheme : HTHEME -> "isize"
// iIntId : INT -> "i32"
// piValue : INT* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t GetThemeSysInt(
    intptr_t hTheme,
    int32_t iIntId,
    int32_t* piValue);
C, "UXTHEME.dll");
// $ffi->GetThemeSysInt(hTheme, iIntId, piValue);
// hTheme : HTHEME
// iIntId : INT
// piValue : INT* out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。
import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;

public interface Uxtheme extends StdCallLibrary {
    Uxtheme INSTANCE = Native.load("uxtheme", Uxtheme.class);
    int GetThemeSysInt(
        long hTheme,   // HTHEME
        int iIntId,   // INT
        IntByReference piValue   // INT* out
    );
}
@[Link("uxtheme")]
lib LibUXTHEME
  fun GetThemeSysInt = GetThemeSysInt(
    hTheme : LibC::SSizeT,   # HTHEME
    iIntId : Int32,   # INT
    piValue : Int32*   # INT* out
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef GetThemeSysIntNative = Int32 Function(IntPtr, Int32, Pointer<Int32>);
typedef GetThemeSysIntDart = int Function(int, int, Pointer<Int32>);
final GetThemeSysInt = DynamicLibrary.open('UXTHEME.dll')
    .lookupFunction<GetThemeSysIntNative, GetThemeSysIntDart>('GetThemeSysInt');
// hTheme : HTHEME -> IntPtr
// iIntId : INT -> Int32
// piValue : INT* out -> Pointer<Int32>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function GetThemeSysInt(
  hTheme: NativeInt;   // HTHEME
  iIntId: Integer;   // INT
  piValue: Pointer   // INT* out
): Integer; stdcall;
  external 'UXTHEME.dll' name 'GetThemeSysInt';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "GetThemeSysInt"
  c_GetThemeSysInt :: CIntPtr -> Int32 -> Ptr Int32 -> IO Int32
-- hTheme : HTHEME -> CIntPtr
-- iIntId : INT -> Int32
-- piValue : INT* out -> Ptr Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let getthemesysint =
  foreign "GetThemeSysInt"
    (intptr_t @-> int32_t @-> (ptr int32_t) @-> returning int32_t)
(* hTheme : HTHEME -> intptr_t *)
(* iIntId : INT -> int32_t *)
(* piValue : INT* out -> (ptr int32_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library uxtheme (t "UXTHEME.dll"))
(cffi:use-foreign-library uxtheme)

(cffi:defcfun ("GetThemeSysInt" get-theme-sys-int :convention :stdcall) :int32
  (h-theme :int64)   ; HTHEME
  (i-int-id :int32)   ; INT
  (pi-value :pointer))   ; INT* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GetThemeSysInt = Win32::API::More->new('UXTHEME',
    'int GetThemeSysInt(LPARAM hTheme, int iIntId, LPVOID piValue)');
# my $ret = $GetThemeSysInt->Call($hTheme, $iIntId, $piValue);
# hTheme : HTHEME -> LPARAM
# iIntId : INT -> int
# piValue : INT* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。