ホーム › UI.Controls › GetThemeSysColorBrush
GetThemeSysColorBrush
関数テーマのシステム色に対応するブラシを取得する。
シグネチャ
// UxTheme.dll
#include <windows.h>
HBRUSH GetThemeSysColorBrush(
HTHEME hTheme, // optional
INT iColorId
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hTheme | HTHEME | inoptional |
| iColorId | INT | in |
戻り値の型: HBRUSH
各言語での呼び出し定義
// UxTheme.dll
#include <windows.h>
HBRUSH GetThemeSysColorBrush(
HTHEME hTheme, // optional
INT iColorId
);[DllImport("UxTheme.dll", ExactSpelling = true)]
static extern IntPtr GetThemeSysColorBrush(
IntPtr hTheme, // HTHEME optional
int iColorId // INT
);<DllImport("UxTheme.dll", ExactSpelling:=True)>
Public Shared Function GetThemeSysColorBrush(
hTheme As IntPtr, ' HTHEME optional
iColorId As Integer ' INT
) As IntPtr
End Function' hTheme : HTHEME optional
' iColorId : INT
Declare PtrSafe Function GetThemeSysColorBrush Lib "uxtheme" ( _
ByVal hTheme As LongPtr, _
ByVal iColorId As Long) As LongPtr
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetThemeSysColorBrush = ctypes.windll.uxtheme.GetThemeSysColorBrush
GetThemeSysColorBrush.restype = ctypes.c_void_p
GetThemeSysColorBrush.argtypes = [
ctypes.c_ssize_t, # hTheme : HTHEME optional
ctypes.c_int, # iColorId : INT
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('UxTheme.dll')
GetThemeSysColorBrush = Fiddle::Function.new(
lib['GetThemeSysColorBrush'],
[
Fiddle::TYPE_INTPTR_T, # hTheme : HTHEME optional
Fiddle::TYPE_INT, # iColorId : INT
],
Fiddle::TYPE_VOIDP)#[link(name = "uxtheme")]
extern "system" {
fn GetThemeSysColorBrush(
hTheme: isize, // HTHEME optional
iColorId: i32 // INT
) -> *mut core::ffi::c_void;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("UxTheme.dll")]
public static extern IntPtr GetThemeSysColorBrush(IntPtr hTheme, int iColorId);
"@
$api = Add-Type -MemberDefinition $sig -Name 'UxTheme_GetThemeSysColorBrush' -Namespace Win32 -PassThru
# $api::GetThemeSysColorBrush(hTheme, iColorId)#uselib "UxTheme.dll"
#func global GetThemeSysColorBrush "GetThemeSysColorBrush" sptr, sptr
; GetThemeSysColorBrush hTheme, iColorId ; 戻り値は stat
; hTheme : HTHEME optional -> "sptr"
; iColorId : INT -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "UxTheme.dll"
#cfunc global GetThemeSysColorBrush "GetThemeSysColorBrush" sptr, int
; res = GetThemeSysColorBrush(hTheme, iColorId)
; hTheme : HTHEME optional -> "sptr"
; iColorId : INT -> "int"; HBRUSH GetThemeSysColorBrush(HTHEME hTheme, INT iColorId)
#uselib "UxTheme.dll"
#cfunc global GetThemeSysColorBrush "GetThemeSysColorBrush" intptr, int
; res = GetThemeSysColorBrush(hTheme, iColorId)
; hTheme : HTHEME optional -> "intptr"
; iColorId : INT -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
uxtheme = windows.NewLazySystemDLL("UxTheme.dll")
procGetThemeSysColorBrush = uxtheme.NewProc("GetThemeSysColorBrush")
)
// hTheme (HTHEME optional), iColorId (INT)
r1, _, err := procGetThemeSysColorBrush.Call(
uintptr(hTheme),
uintptr(iColorId),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HBRUSHfunction GetThemeSysColorBrush(
hTheme: NativeInt; // HTHEME optional
iColorId: Integer // INT
): THandle; stdcall;
external 'UxTheme.dll' name 'GetThemeSysColorBrush';result := DllCall("UxTheme\GetThemeSysColorBrush"
, "Ptr", hTheme ; HTHEME optional
, "Int", iColorId ; INT
, "Ptr") ; return: HBRUSH●GetThemeSysColorBrush(hTheme, iColorId) = DLL("UxTheme.dll", "void* GetThemeSysColorBrush(int, int)")
# 呼び出し: GetThemeSysColorBrush(hTheme, iColorId)
# hTheme : HTHEME optional -> "int"
# iColorId : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。