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

GetThemeDocumentationProperty

関数
指定テーマのドキュメントプロパティ値を取得する。
DLLUxTheme.dll呼出規約winapi対応OSWindows Vista 以降

シグネチャ

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

HRESULT GetThemeDocumentationProperty(
    LPCWSTR pszThemeName,
    LPCWSTR pszPropertyName,
    LPWSTR pszValueBuff,
    INT cchMaxValChars
);

パラメーター

名前方向
pszThemeNameLPCWSTRin
pszPropertyNameLPCWSTRin
pszValueBuffLPWSTRout
cchMaxValCharsINTin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT GetThemeDocumentationProperty(
    LPCWSTR pszThemeName,
    LPCWSTR pszPropertyName,
    LPWSTR pszValueBuff,
    INT cchMaxValChars
);
[DllImport("UxTheme.dll", ExactSpelling = true)]
static extern int GetThemeDocumentationProperty(
    [MarshalAs(UnmanagedType.LPWStr)] string pszThemeName,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] string pszPropertyName,   // LPCWSTR
    [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pszValueBuff,   // LPWSTR out
    int cchMaxValChars   // INT
);
<DllImport("UxTheme.dll", ExactSpelling:=True)>
Public Shared Function GetThemeDocumentationProperty(
    <MarshalAs(UnmanagedType.LPWStr)> pszThemeName As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> pszPropertyName As String,   ' LPCWSTR
    <MarshalAs(UnmanagedType.LPWStr)> pszValueBuff As System.Text.StringBuilder,   ' LPWSTR out
    cchMaxValChars As Integer   ' INT
) As Integer
End Function
' pszThemeName : LPCWSTR
' pszPropertyName : LPCWSTR
' pszValueBuff : LPWSTR out
' cchMaxValChars : INT
Declare PtrSafe Function GetThemeDocumentationProperty Lib "uxtheme" ( _
    ByVal pszThemeName As LongPtr, _
    ByVal pszPropertyName As LongPtr, _
    ByVal pszValueBuff As LongPtr, _
    ByVal cchMaxValChars As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetThemeDocumentationProperty = ctypes.windll.uxtheme.GetThemeDocumentationProperty
GetThemeDocumentationProperty.restype = ctypes.c_int
GetThemeDocumentationProperty.argtypes = [
    wintypes.LPCWSTR,  # pszThemeName : LPCWSTR
    wintypes.LPCWSTR,  # pszPropertyName : LPCWSTR
    wintypes.LPWSTR,  # pszValueBuff : LPWSTR out
    ctypes.c_int,  # cchMaxValChars : INT
]
require 'fiddle'
require 'fiddle/import'

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

var (
	uxtheme = windows.NewLazySystemDLL("UxTheme.dll")
	procGetThemeDocumentationProperty = uxtheme.NewProc("GetThemeDocumentationProperty")
)

// pszThemeName (LPCWSTR), pszPropertyName (LPCWSTR), pszValueBuff (LPWSTR out), cchMaxValChars (INT)
r1, _, err := procGetThemeDocumentationProperty.Call(
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszThemeName))),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pszPropertyName))),
	uintptr(pszValueBuff),
	uintptr(cchMaxValChars),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function GetThemeDocumentationProperty(
  pszThemeName: PWideChar;   // LPCWSTR
  pszPropertyName: PWideChar;   // LPCWSTR
  pszValueBuff: PWideChar;   // LPWSTR out
  cchMaxValChars: Integer   // INT
): Integer; stdcall;
  external 'UxTheme.dll' name 'GetThemeDocumentationProperty';
result := DllCall("UxTheme\GetThemeDocumentationProperty"
    , "WStr", pszThemeName   ; LPCWSTR
    , "WStr", pszPropertyName   ; LPCWSTR
    , "Ptr", pszValueBuff   ; LPWSTR out
    , "Int", cchMaxValChars   ; INT
    , "Int")   ; return: HRESULT
●GetThemeDocumentationProperty(pszThemeName, pszPropertyName, pszValueBuff, cchMaxValChars) = DLL("UxTheme.dll", "int GetThemeDocumentationProperty(char*, char*, char*, int)")
# 呼び出し: GetThemeDocumentationProperty(pszThemeName, pszPropertyName, pszValueBuff, cchMaxValChars)
# pszThemeName : LPCWSTR -> "char*"
# pszPropertyName : LPCWSTR -> "char*"
# pszValueBuff : LPWSTR out -> "char*"
# cchMaxValChars : INT -> "int"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。