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