ホーム › Graphics.Gdi › GetCharABCWidthsFloatW
GetCharABCWidthsFloatW
関数文字のABC幅を小数値で取得する。
シグネチャ
// GDI32.dll (Unicode / -W)
#include <windows.h>
BOOL GetCharABCWidthsFloatW(
HDC hdc,
DWORD iFirst,
DWORD iLast,
ABCFLOAT* lpABC
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | in |
| iFirst | DWORD | in |
| iLast | DWORD | in |
| lpABC | ABCFLOAT* | out |
戻り値の型: BOOL
各言語での呼び出し定義
// GDI32.dll (Unicode / -W)
#include <windows.h>
BOOL GetCharABCWidthsFloatW(
HDC hdc,
DWORD iFirst,
DWORD iLast,
ABCFLOAT* lpABC
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", CharSet = CharSet.Unicode, ExactSpelling = true)]
static extern bool GetCharABCWidthsFloatW(
IntPtr hdc, // HDC
uint iFirst, // DWORD
uint iLast, // DWORD
IntPtr lpABC // ABCFLOAT* out
);<DllImport("GDI32.dll", CharSet:=CharSet.Unicode, ExactSpelling:=True)>
Public Shared Function GetCharABCWidthsFloatW(
hdc As IntPtr, ' HDC
iFirst As UInteger, ' DWORD
iLast As UInteger, ' DWORD
lpABC As IntPtr ' ABCFLOAT* out
) As Boolean
End Function' hdc : HDC
' iFirst : DWORD
' iLast : DWORD
' lpABC : ABCFLOAT* out
Declare PtrSafe Function GetCharABCWidthsFloatW Lib "gdi32" ( _
ByVal hdc As LongPtr, _
ByVal iFirst As Long, _
ByVal iLast As Long, _
ByVal lpABC As LongPtr) As Long
' Unicode(W): 文字列は ByVal As LongPtr とし StrPtr(unicodeStr) を渡す
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetCharABCWidthsFloatW = ctypes.windll.gdi32.GetCharABCWidthsFloatW
GetCharABCWidthsFloatW.restype = wintypes.BOOL
GetCharABCWidthsFloatW.argtypes = [
wintypes.HANDLE, # hdc : HDC
wintypes.DWORD, # iFirst : DWORD
wintypes.DWORD, # iLast : DWORD
ctypes.c_void_p, # lpABC : ABCFLOAT* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
GetCharABCWidthsFloatW = Fiddle::Function.new(
lib['GetCharABCWidthsFloatW'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
-Fiddle::TYPE_INT, # iFirst : DWORD
-Fiddle::TYPE_INT, # iLast : DWORD
Fiddle::TYPE_VOIDP, # lpABC : ABCFLOAT* out
],
Fiddle::TYPE_INT)
# Wide strings: pass str.encode("UTF-16LE") + "\x00\x00"#[link(name = "gdi32")]
extern "system" {
fn GetCharABCWidthsFloatW(
hdc: *mut core::ffi::c_void, // HDC
iFirst: u32, // DWORD
iLast: u32, // DWORD
lpABC: *mut ABCFLOAT // ABCFLOAT* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", CharSet = CharSet.Unicode)]
public static extern bool GetCharABCWidthsFloatW(IntPtr hdc, uint iFirst, uint iLast, IntPtr lpABC);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_GetCharABCWidthsFloatW' -Namespace Win32 -PassThru
# $api::GetCharABCWidthsFloatW(hdc, iFirst, iLast, lpABC)#uselib "GDI32.dll"
#func global GetCharABCWidthsFloatW "GetCharABCWidthsFloatW" wptr, wptr, wptr, wptr
; GetCharABCWidthsFloatW hdc, iFirst, iLast, varptr(lpABC) ; 戻り値は stat
; hdc : HDC -> "wptr"
; iFirst : DWORD -> "wptr"
; iLast : DWORD -> "wptr"
; lpABC : ABCFLOAT* out -> "wptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "GDI32.dll" #cfunc global GetCharABCWidthsFloatW "GetCharABCWidthsFloatW" sptr, int, int, var ; res = GetCharABCWidthsFloatW(hdc, iFirst, iLast, lpABC) ; hdc : HDC -> "sptr" ; iFirst : DWORD -> "int" ; iLast : DWORD -> "int" ; lpABC : ABCFLOAT* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "GDI32.dll" #cfunc global GetCharABCWidthsFloatW "GetCharABCWidthsFloatW" sptr, int, int, sptr ; res = GetCharABCWidthsFloatW(hdc, iFirst, iLast, varptr(lpABC)) ; hdc : HDC -> "sptr" ; iFirst : DWORD -> "int" ; iLast : DWORD -> "int" ; lpABC : ABCFLOAT* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GetCharABCWidthsFloatW(HDC hdc, DWORD iFirst, DWORD iLast, ABCFLOAT* lpABC) #uselib "GDI32.dll" #cfunc global GetCharABCWidthsFloatW "GetCharABCWidthsFloatW" intptr, int, int, var ; res = GetCharABCWidthsFloatW(hdc, iFirst, iLast, lpABC) ; hdc : HDC -> "intptr" ; iFirst : DWORD -> "int" ; iLast : DWORD -> "int" ; lpABC : ABCFLOAT* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GetCharABCWidthsFloatW(HDC hdc, DWORD iFirst, DWORD iLast, ABCFLOAT* lpABC) #uselib "GDI32.dll" #cfunc global GetCharABCWidthsFloatW "GetCharABCWidthsFloatW" intptr, int, int, intptr ; res = GetCharABCWidthsFloatW(hdc, iFirst, iLast, varptr(lpABC)) ; hdc : HDC -> "intptr" ; iFirst : DWORD -> "int" ; iLast : DWORD -> "int" ; lpABC : ABCFLOAT* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procGetCharABCWidthsFloatW = gdi32.NewProc("GetCharABCWidthsFloatW")
)
// hdc (HDC), iFirst (DWORD), iLast (DWORD), lpABC (ABCFLOAT* out)
r1, _, err := procGetCharABCWidthsFloatW.Call(
uintptr(hdc),
uintptr(iFirst),
uintptr(iLast),
uintptr(lpABC),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GetCharABCWidthsFloatW(
hdc: THandle; // HDC
iFirst: DWORD; // DWORD
iLast: DWORD; // DWORD
lpABC: Pointer // ABCFLOAT* out
): BOOL; stdcall;
external 'GDI32.dll' name 'GetCharABCWidthsFloatW';result := DllCall("GDI32\GetCharABCWidthsFloatW"
, "Ptr", hdc ; HDC
, "UInt", iFirst ; DWORD
, "UInt", iLast ; DWORD
, "Ptr", lpABC ; ABCFLOAT* out
, "Int") ; return: BOOL●GetCharABCWidthsFloatW(hdc, iFirst, iLast, lpABC) = DLL("GDI32.dll", "bool GetCharABCWidthsFloatW(void*, dword, dword, void*)")
# 呼び出し: GetCharABCWidthsFloatW(hdc, iFirst, iLast, lpABC)
# hdc : HDC -> "void*"
# iFirst : DWORD -> "dword"
# iLast : DWORD -> "dword"
# lpABC : ABCFLOAT* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※-W(Unicode)関数。なでしこ1はANSIのため -A 版の利用を推奨。