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取得したプロパティ値を受け取る出力バッファへのポインタ。
cchMaxValCharsINTinpszValueBuffバッファの最大文字数。

戻り値の型: 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)。
const std = @import("std");

extern "uxtheme" fn GetThemeDocumentationProperty(
    pszThemeName: [*c]const u16, // LPCWSTR
    pszPropertyName: [*c]const u16, // LPCWSTR
    pszValueBuff: [*c]u16, // LPWSTR out
    cchMaxValChars: i32 // INT
) callconv(std.os.windows.WINAPI) i32;
proc GetThemeDocumentationProperty(
    pszThemeName: WideCString,  # LPCWSTR
    pszPropertyName: WideCString,  # LPCWSTR
    pszValueBuff: ptr uint16,  # LPWSTR out
    cchMaxValChars: int32  # INT
): int32 {.importc: "GetThemeDocumentationProperty", stdcall, dynlib: "UXTHEME.dll".}
pragma(lib, "uxtheme");
extern(Windows)
int GetThemeDocumentationProperty(
    const(wchar)* pszThemeName,   // LPCWSTR
    const(wchar)* pszPropertyName,   // LPCWSTR
    wchar* pszValueBuff,   // LPWSTR out
    int cchMaxValChars   // INT
);
ccall((:GetThemeDocumentationProperty, "UXTHEME.dll"), stdcall, Int32,
      (Cwstring, Cwstring, Ptr{UInt16}, Int32),
      pszThemeName, pszPropertyName, pszValueBuff, cchMaxValChars)
# pszThemeName : LPCWSTR -> Cwstring
# pszPropertyName : LPCWSTR -> Cwstring
# pszValueBuff : LPWSTR out -> Ptr{UInt16}
# cchMaxValChars : INT -> Int32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t GetThemeDocumentationProperty(
    const uint16_t* pszThemeName,
    const uint16_t* pszPropertyName,
    uint16_t* pszValueBuff,
    int32_t cchMaxValChars);
]]
local uxtheme = ffi.load("uxtheme")
-- uxtheme.GetThemeDocumentationProperty(pszThemeName, pszPropertyName, pszValueBuff, cchMaxValChars)
-- pszThemeName : LPCWSTR
-- pszPropertyName : LPCWSTR
-- pszValueBuff : LPWSTR out
-- cchMaxValChars : INT
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('UXTHEME.dll');
const GetThemeDocumentationProperty = lib.func('__stdcall', 'GetThemeDocumentationProperty', 'int32_t', ['str16', 'str16', 'uint16_t *', 'int32_t']);
// GetThemeDocumentationProperty(pszThemeName, pszPropertyName, pszValueBuff, cchMaxValChars)
// pszThemeName : LPCWSTR -> 'str16'
// pszPropertyName : LPCWSTR -> 'str16'
// pszValueBuff : LPWSTR out -> 'uint16_t *'
// cchMaxValChars : INT -> 'int32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("UXTHEME.dll", {
  GetThemeDocumentationProperty: { parameters: ["buffer", "buffer", "buffer", "i32"], result: "i32" },
});
// lib.symbols.GetThemeDocumentationProperty(pszThemeName, pszPropertyName, pszValueBuff, cchMaxValChars)
// pszThemeName : LPCWSTR -> "buffer"
// pszPropertyName : LPCWSTR -> "buffer"
// pszValueBuff : LPWSTR out -> "buffer"
// cchMaxValChars : INT -> "i32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t GetThemeDocumentationProperty(
    const uint16_t* pszThemeName,
    const uint16_t* pszPropertyName,
    uint16_t* pszValueBuff,
    int32_t cchMaxValChars);
C, "UXTHEME.dll");
// $ffi->GetThemeDocumentationProperty(pszThemeName, pszPropertyName, pszValueBuff, cchMaxValChars);
// pszThemeName : LPCWSTR
// pszPropertyName : LPCWSTR
// pszValueBuff : LPWSTR out
// cchMaxValChars : 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);
    int GetThemeDocumentationProperty(
        WString pszThemeName,   // LPCWSTR
        WString pszPropertyName,   // LPCWSTR
        char[] pszValueBuff,   // LPWSTR out
        int cchMaxValChars   // INT
    );
}
@[Link("uxtheme")]
lib LibUXTHEME
  fun GetThemeDocumentationProperty = GetThemeDocumentationProperty(
    pszThemeName : UInt16*,   # LPCWSTR
    pszPropertyName : UInt16*,   # LPCWSTR
    pszValueBuff : UInt16*,   # LPWSTR out
    cchMaxValChars : 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 GetThemeDocumentationPropertyNative = Int32 Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, Int32);
typedef GetThemeDocumentationPropertyDart = int Function(Pointer<Utf16>, Pointer<Utf16>, Pointer<Utf16>, int);
final GetThemeDocumentationProperty = DynamicLibrary.open('UXTHEME.dll')
    .lookupFunction<GetThemeDocumentationPropertyNative, GetThemeDocumentationPropertyDart>('GetThemeDocumentationProperty');
// pszThemeName : LPCWSTR -> Pointer<Utf16>
// pszPropertyName : LPCWSTR -> Pointer<Utf16>
// pszValueBuff : LPWSTR out -> Pointer<Utf16>
// cchMaxValChars : INT -> Int32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function GetThemeDocumentationProperty(
  pszThemeName: PWideChar;   // LPCWSTR
  pszPropertyName: PWideChar;   // LPCWSTR
  pszValueBuff: PWideChar;   // LPWSTR out
  cchMaxValChars: Integer   // INT
): Integer; stdcall;
  external 'UXTHEME.dll' name 'GetThemeDocumentationProperty';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "GetThemeDocumentationProperty"
  c_GetThemeDocumentationProperty :: CWString -> CWString -> CWString -> Int32 -> IO Int32
-- pszThemeName : LPCWSTR -> CWString
-- pszPropertyName : LPCWSTR -> CWString
-- pszValueBuff : LPWSTR out -> CWString
-- cchMaxValChars : INT -> Int32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let getthemedocumentationproperty =
  foreign "GetThemeDocumentationProperty"
    ((ptr uint16_t) @-> (ptr uint16_t) @-> (ptr uint16_t) @-> int32_t @-> returning int32_t)
(* pszThemeName : LPCWSTR -> (ptr uint16_t) *)
(* pszPropertyName : LPCWSTR -> (ptr uint16_t) *)
(* pszValueBuff : LPWSTR out -> (ptr uint16_t) *)
(* cchMaxValChars : 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 ("GetThemeDocumentationProperty" get-theme-documentation-property :convention :stdcall) :int32
  (psz-theme-name (:string :encoding :utf-16le))   ; LPCWSTR
  (psz-property-name (:string :encoding :utf-16le))   ; LPCWSTR
  (psz-value-buff :pointer)   ; LPWSTR out
  (cch-max-val-chars :int32))   ; INT
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GetThemeDocumentationProperty = Win32::API::More->new('UXTHEME',
    'int GetThemeDocumentationProperty(LPCWSTR pszThemeName, LPCWSTR pszPropertyName, LPWSTR pszValueBuff, int cchMaxValChars)');
# my $ret = $GetThemeDocumentationProperty->Call($pszThemeName, $pszPropertyName, $pszValueBuff, $cchMaxValChars);
# pszThemeName : LPCWSTR -> LPCWSTR
# pszPropertyName : LPCWSTR -> LPCWSTR
# pszValueBuff : LPWSTR out -> LPWSTR
# cchMaxValChars : INT -> int
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。