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

GetThemeSysBool

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

シグネチャ

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

BOOL GetThemeSysBool(
    HTHEME hTheme,   // optional
    INT iBoolId
);

パラメーター

名前方向説明
hThemeHTHEMEinoptionalテーマデータへのハンドル。
iBoolIdINTin

取得するシステムのブールメトリックを指定する int 型の値。次の値を指定できます。

意味
TMT_FLATMENUS
メニューの描画方法を表します。TRUE の場合、メニューは影なしで描画されます。FALSE の場合、メニューの下に影が付きます。

戻り値の型: BOOL

公式ドキュメント

システムメトリックのブール値を取得します。

戻り値

型: BOOL

取得したシステムメトリックの値。

解説(Remarks)

テーマデータハンドルが NULL ハンドルでない場合、この関数はビジュアルスタイルの SysMetrics セクションから目的の BOOL を返します。テーマデータハンドルが NULL の場合、この関数は指定されたシステムのブール値を返します。

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

各言語での呼び出し定義

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

BOOL GetThemeSysBool(
    HTHEME hTheme,   // optional
    INT iBoolId
);
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("UXTHEME.dll", ExactSpelling = true)]
static extern bool GetThemeSysBool(
    IntPtr hTheme,   // HTHEME optional
    int iBoolId   // INT
);
<DllImport("UXTHEME.dll", ExactSpelling:=True)>
Public Shared Function GetThemeSysBool(
    hTheme As IntPtr,   ' HTHEME optional
    iBoolId As Integer   ' INT
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function
' hTheme : HTHEME optional
' iBoolId : INT
Declare PtrSafe Function GetThemeSysBool Lib "uxtheme" ( _
    ByVal hTheme As LongPtr, _
    ByVal iBoolId As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetThemeSysBool = ctypes.windll.uxtheme.GetThemeSysBool
GetThemeSysBool.restype = wintypes.BOOL
GetThemeSysBool.argtypes = [
    ctypes.c_ssize_t,  # hTheme : HTHEME optional
    ctypes.c_int,  # iBoolId : INT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	uxtheme = windows.NewLazySystemDLL("UXTHEME.dll")
	procGetThemeSysBool = uxtheme.NewProc("GetThemeSysBool")
)

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

extern "uxtheme" fn GetThemeSysBool(
    hTheme: isize, // HTHEME optional
    iBoolId: i32 // INT
) callconv(std.os.windows.WINAPI) i32;
proc GetThemeSysBool(
    hTheme: int,  # HTHEME optional
    iBoolId: int32  # INT
): int32 {.importc: "GetThemeSysBool", stdcall, dynlib: "UXTHEME.dll".}
pragma(lib, "uxtheme");
extern(Windows)
int GetThemeSysBool(
    ptrdiff_t hTheme,   // HTHEME optional
    int iBoolId   // INT
);
ccall((:GetThemeSysBool, "UXTHEME.dll"), stdcall, Int32,
      (Int, Int32),
      hTheme, iBoolId)
# hTheme : HTHEME optional -> Int
# iBoolId : INT -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t GetThemeSysBool(
    intptr_t hTheme,
    int32_t iBoolId);
]]
local uxtheme = ffi.load("uxtheme")
-- uxtheme.GetThemeSysBool(hTheme, iBoolId)
-- hTheme : HTHEME optional
-- iBoolId : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('UXTHEME.dll');
const GetThemeSysBool = lib.func('__stdcall', 'GetThemeSysBool', 'int32_t', ['intptr_t', 'int32_t']);
// GetThemeSysBool(hTheme, iBoolId)
// hTheme : HTHEME optional -> 'intptr_t'
// iBoolId : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("UXTHEME.dll", {
  GetThemeSysBool: { parameters: ["isize", "i32"], result: "i32" },
});
// lib.symbols.GetThemeSysBool(hTheme, iBoolId)
// hTheme : HTHEME optional -> "isize"
// iBoolId : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t GetThemeSysBool(
    intptr_t hTheme,
    int32_t iBoolId);
C, "UXTHEME.dll");
// $ffi->GetThemeSysBool(hTheme, iBoolId);
// hTheme : HTHEME optional
// iBoolId : INT
// 構造体/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);
    boolean GetThemeSysBool(
        long hTheme,   // HTHEME optional
        int iBoolId   // INT
    );
}
@[Link("uxtheme")]
lib LibUXTHEME
  fun GetThemeSysBool = GetThemeSysBool(
    hTheme : LibC::SSizeT,   # HTHEME optional
    iBoolId : Int32   # INT
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

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

foreign import stdcall safe "GetThemeSysBool"
  c_GetThemeSysBool :: CIntPtr -> Int32 -> IO CInt
-- hTheme : HTHEME optional -> CIntPtr
-- iBoolId : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

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

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