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