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