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