ホーム › Graphics.Gdi › GetTextExtentExPointI
GetTextExtentExPointI
関数指定幅に収まるグリフ数と寸法を取得する。
シグネチャ
// GDI32.dll
#include <windows.h>
BOOL GetTextExtentExPointI(
HDC hdc,
WORD* lpwszString,
INT cwchString,
INT nMaxExtent,
INT* lpnFit, // optional
INT* lpnDx, // optional
SIZE* lpSize
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hdc | HDC | in | デバイスコンテキストへのハンドル。 |
| lpwszString | WORD* | in | 幅を取得する対象となるグリフインデックスの配列へのポインター。 |
| cwchString | INT | in | lpwszString パラメーターが指すグリフインデックス配列内のグリフ数。 |
| nMaxExtent | INT | in | 書式設定された文字列の最大許容幅(論理単位)。 |
| lpnFit | INT* | outoptional | nMaxExtent パラメーターで指定された幅に収まる最大文字数を受け取る整数へのポインター。lpnFit パラメーターが NULL の場合、nMaxExtent パラメーターは無視されます。 |
| lpnDx | INT* | outoptional | 部分的なグリフ幅を受け取る整数配列へのポインター。配列の各要素は、グリフインデックス配列の先頭から、nMaxExtent パラメーターで指定された幅に収まる各グリフまでの距離(論理単位)を示します。この配列は cwchString パラメーターで指定されたグリフインデックス数と同数以上の要素を持つべきですが、関数は lpnFit パラメーターで指定された数のグリフインデックスについてのみ幅を配列に格納します。lpnFit が NULL の場合、関数は部分的な文字列幅を計算しません。 |
| lpSize | SIZE* | out | グリフインデックス配列の寸法(論理単位)を受け取る SIZE 構造体へのポインター。この値を NULL にすることはできません。 |
戻り値の型: BOOL
公式ドキュメント
GetTextExtentExPointI 関数は、指定された幅に収まる文字列中の文字数を取得し、それらの各文字のテキスト幅を配列に格納します。
戻り値
関数が成功した場合、戻り値は 0 以外の値です。
関数が失敗した場合、戻り値は 0 です。
解説(Remarks)
lpnFit パラメーターと lpnDx パラメーターの両方が NULL の場合、GetTextExtentExPointI 関数の呼び出しは GetTextExtentPointI 関数の呼び出しと同等です。
この関数がテキスト幅を返す際には、テキストが水平方向である、つまりエスケープメント(escapement)が常に 0 であると仮定します。これはテキストの水平方向の測定にも垂直方向の測定にも当てはまります。0 以外のエスケープメントを指定するフォントを使用した場合でも、この関数はテキスト幅の計算時にその角度を使用しません。アプリ側で明示的に変換する必要があります。ただし、グラフィックスモードが GM_ADVANCED に設定され、文字の向きが印刷の向きから 90 度回転している場合、この関数が返す値はこのルールに従いません。ある文字列について文字の向きと印刷の向きが一致している場合、この関数は文字列の寸法を SIZE 構造体に { cx : 116, cy : 18 } として返します。同じ文字列について文字の向きと印刷の向きが 90 度異なる場合、この関数は文字列の寸法を SIZE 構造体に { cx : 18, cy : 116 } として返します。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// GDI32.dll
#include <windows.h>
BOOL GetTextExtentExPointI(
HDC hdc,
WORD* lpwszString,
INT cwchString,
INT nMaxExtent,
INT* lpnFit, // optional
INT* lpnDx, // optional
SIZE* lpSize
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll", ExactSpelling = true)]
static extern bool GetTextExtentExPointI(
IntPtr hdc, // HDC
ref ushort lpwszString, // WORD*
int cwchString, // INT
int nMaxExtent, // INT
IntPtr lpnFit, // INT* optional, out
IntPtr lpnDx, // INT* optional, out
IntPtr lpSize // SIZE* out
);<DllImport("GDI32.dll", ExactSpelling:=True)>
Public Shared Function GetTextExtentExPointI(
hdc As IntPtr, ' HDC
ByRef lpwszString As UShort, ' WORD*
cwchString As Integer, ' INT
nMaxExtent As Integer, ' INT
lpnFit As IntPtr, ' INT* optional, out
lpnDx As IntPtr, ' INT* optional, out
lpSize As IntPtr ' SIZE* out
) As <MarshalAs(UnmanagedType.Bool)> Boolean
End Function' hdc : HDC
' lpwszString : WORD*
' cwchString : INT
' nMaxExtent : INT
' lpnFit : INT* optional, out
' lpnDx : INT* optional, out
' lpSize : SIZE* out
Declare PtrSafe Function GetTextExtentExPointI Lib "gdi32" ( _
ByVal hdc As LongPtr, _
ByRef lpwszString As Integer, _
ByVal cwchString As Long, _
ByVal nMaxExtent As Long, _
ByVal lpnFit As LongPtr, _
ByVal lpnDx As LongPtr, _
ByVal lpSize As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetTextExtentExPointI = ctypes.windll.gdi32.GetTextExtentExPointI
GetTextExtentExPointI.restype = wintypes.BOOL
GetTextExtentExPointI.argtypes = [
wintypes.HANDLE, # hdc : HDC
ctypes.POINTER(ctypes.c_ushort), # lpwszString : WORD*
ctypes.c_int, # cwchString : INT
ctypes.c_int, # nMaxExtent : INT
ctypes.POINTER(ctypes.c_int), # lpnFit : INT* optional, out
ctypes.POINTER(ctypes.c_int), # lpnDx : INT* optional, out
ctypes.c_void_p, # lpSize : SIZE* out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('GDI32.dll')
GetTextExtentExPointI = Fiddle::Function.new(
lib['GetTextExtentExPointI'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
Fiddle::TYPE_VOIDP, # lpwszString : WORD*
Fiddle::TYPE_INT, # cwchString : INT
Fiddle::TYPE_INT, # nMaxExtent : INT
Fiddle::TYPE_VOIDP, # lpnFit : INT* optional, out
Fiddle::TYPE_VOIDP, # lpnDx : INT* optional, out
Fiddle::TYPE_VOIDP, # lpSize : SIZE* out
],
Fiddle::TYPE_INT)#[link(name = "gdi32")]
extern "system" {
fn GetTextExtentExPointI(
hdc: *mut core::ffi::c_void, // HDC
lpwszString: *mut u16, // WORD*
cwchString: i32, // INT
nMaxExtent: i32, // INT
lpnFit: *mut i32, // INT* optional, out
lpnDx: *mut i32, // INT* optional, out
lpSize: *mut SIZE // SIZE* out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("GDI32.dll")]
public static extern bool GetTextExtentExPointI(IntPtr hdc, ref ushort lpwszString, int cwchString, int nMaxExtent, IntPtr lpnFit, IntPtr lpnDx, IntPtr lpSize);
"@
$api = Add-Type -MemberDefinition $sig -Name 'GDI32_GetTextExtentExPointI' -Namespace Win32 -PassThru
# $api::GetTextExtentExPointI(hdc, lpwszString, cwchString, nMaxExtent, lpnFit, lpnDx, lpSize)#uselib "GDI32.dll"
#func global GetTextExtentExPointI "GetTextExtentExPointI" sptr, sptr, sptr, sptr, sptr, sptr, sptr
; GetTextExtentExPointI hdc, varptr(lpwszString), cwchString, nMaxExtent, varptr(lpnFit), varptr(lpnDx), varptr(lpSize) ; 戻り値は stat
; hdc : HDC -> "sptr"
; lpwszString : WORD* -> "sptr"
; cwchString : INT -> "sptr"
; nMaxExtent : INT -> "sptr"
; lpnFit : INT* optional, out -> "sptr"
; lpnDx : INT* optional, out -> "sptr"
; lpSize : SIZE* out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "GDI32.dll" #cfunc global GetTextExtentExPointI "GetTextExtentExPointI" sptr, var, int, int, var, var, var ; res = GetTextExtentExPointI(hdc, lpwszString, cwchString, nMaxExtent, lpnFit, lpnDx, lpSize) ; hdc : HDC -> "sptr" ; lpwszString : WORD* -> "var" ; cwchString : INT -> "int" ; nMaxExtent : INT -> "int" ; lpnFit : INT* optional, out -> "var" ; lpnDx : INT* optional, out -> "var" ; lpSize : SIZE* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "GDI32.dll" #cfunc global GetTextExtentExPointI "GetTextExtentExPointI" sptr, sptr, int, int, sptr, sptr, sptr ; res = GetTextExtentExPointI(hdc, varptr(lpwszString), cwchString, nMaxExtent, varptr(lpnFit), varptr(lpnDx), varptr(lpSize)) ; hdc : HDC -> "sptr" ; lpwszString : WORD* -> "sptr" ; cwchString : INT -> "int" ; nMaxExtent : INT -> "int" ; lpnFit : INT* optional, out -> "sptr" ; lpnDx : INT* optional, out -> "sptr" ; lpSize : SIZE* out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; BOOL GetTextExtentExPointI(HDC hdc, WORD* lpwszString, INT cwchString, INT nMaxExtent, INT* lpnFit, INT* lpnDx, SIZE* lpSize) #uselib "GDI32.dll" #cfunc global GetTextExtentExPointI "GetTextExtentExPointI" intptr, var, int, int, var, var, var ; res = GetTextExtentExPointI(hdc, lpwszString, cwchString, nMaxExtent, lpnFit, lpnDx, lpSize) ; hdc : HDC -> "intptr" ; lpwszString : WORD* -> "var" ; cwchString : INT -> "int" ; nMaxExtent : INT -> "int" ; lpnFit : INT* optional, out -> "var" ; lpnDx : INT* optional, out -> "var" ; lpSize : SIZE* out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; BOOL GetTextExtentExPointI(HDC hdc, WORD* lpwszString, INT cwchString, INT nMaxExtent, INT* lpnFit, INT* lpnDx, SIZE* lpSize) #uselib "GDI32.dll" #cfunc global GetTextExtentExPointI "GetTextExtentExPointI" intptr, intptr, int, int, intptr, intptr, intptr ; res = GetTextExtentExPointI(hdc, varptr(lpwszString), cwchString, nMaxExtent, varptr(lpnFit), varptr(lpnDx), varptr(lpSize)) ; hdc : HDC -> "intptr" ; lpwszString : WORD* -> "intptr" ; cwchString : INT -> "int" ; nMaxExtent : INT -> "int" ; lpnFit : INT* optional, out -> "intptr" ; lpnDx : INT* optional, out -> "intptr" ; lpSize : SIZE* out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
gdi32 = windows.NewLazySystemDLL("GDI32.dll")
procGetTextExtentExPointI = gdi32.NewProc("GetTextExtentExPointI")
)
// hdc (HDC), lpwszString (WORD*), cwchString (INT), nMaxExtent (INT), lpnFit (INT* optional, out), lpnDx (INT* optional, out), lpSize (SIZE* out)
r1, _, err := procGetTextExtentExPointI.Call(
uintptr(hdc),
uintptr(lpwszString),
uintptr(cwchString),
uintptr(nMaxExtent),
uintptr(lpnFit),
uintptr(lpnDx),
uintptr(lpSize),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction GetTextExtentExPointI(
hdc: THandle; // HDC
lpwszString: Pointer; // WORD*
cwchString: Integer; // INT
nMaxExtent: Integer; // INT
lpnFit: Pointer; // INT* optional, out
lpnDx: Pointer; // INT* optional, out
lpSize: Pointer // SIZE* out
): BOOL; stdcall;
external 'GDI32.dll' name 'GetTextExtentExPointI';result := DllCall("GDI32\GetTextExtentExPointI"
, "Ptr", hdc ; HDC
, "Ptr", lpwszString ; WORD*
, "Int", cwchString ; INT
, "Int", nMaxExtent ; INT
, "Ptr", lpnFit ; INT* optional, out
, "Ptr", lpnDx ; INT* optional, out
, "Ptr", lpSize ; SIZE* out
, "Int") ; return: BOOL●GetTextExtentExPointI(hdc, lpwszString, cwchString, nMaxExtent, lpnFit, lpnDx, lpSize) = DLL("GDI32.dll", "bool GetTextExtentExPointI(void*, void*, int, int, void*, void*, void*)")
# 呼び出し: GetTextExtentExPointI(hdc, lpwszString, cwchString, nMaxExtent, lpnFit, lpnDx, lpSize)
# hdc : HDC -> "void*"
# lpwszString : WORD* -> "void*"
# cwchString : INT -> "int"
# nMaxExtent : INT -> "int"
# lpnFit : INT* optional, out -> "void*"
# lpnDx : INT* optional, out -> "void*"
# lpSize : SIZE* out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "gdi32" fn GetTextExtentExPointI(
hdc: ?*anyopaque, // HDC
lpwszString: [*c]u16, // WORD*
cwchString: i32, // INT
nMaxExtent: i32, // INT
lpnFit: [*c]i32, // INT* optional, out
lpnDx: [*c]i32, // INT* optional, out
lpSize: [*c]SIZE // SIZE* out
) callconv(std.os.windows.WINAPI) i32;proc GetTextExtentExPointI(
hdc: pointer, # HDC
lpwszString: ptr uint16, # WORD*
cwchString: int32, # INT
nMaxExtent: int32, # INT
lpnFit: ptr int32, # INT* optional, out
lpnDx: ptr int32, # INT* optional, out
lpSize: ptr SIZE # SIZE* out
): int32 {.importc: "GetTextExtentExPointI", stdcall, dynlib: "GDI32.dll".}pragma(lib, "gdi32");
extern(Windows)
int GetTextExtentExPointI(
void* hdc, // HDC
ushort* lpwszString, // WORD*
int cwchString, // INT
int nMaxExtent, // INT
int* lpnFit, // INT* optional, out
int* lpnDx, // INT* optional, out
SIZE* lpSize // SIZE* out
);ccall((:GetTextExtentExPointI, "GDI32.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{UInt16}, Int32, Int32, Ptr{Int32}, Ptr{Int32}, Ptr{SIZE}),
hdc, lpwszString, cwchString, nMaxExtent, lpnFit, lpnDx, lpSize)
# hdc : HDC -> Ptr{Cvoid}
# lpwszString : WORD* -> Ptr{UInt16}
# cwchString : INT -> Int32
# nMaxExtent : INT -> Int32
# lpnFit : INT* optional, out -> Ptr{Int32}
# lpnDx : INT* optional, out -> Ptr{Int32}
# lpSize : SIZE* out -> Ptr{SIZE}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GetTextExtentExPointI(
void* hdc,
uint16_t* lpwszString,
int32_t cwchString,
int32_t nMaxExtent,
int32_t* lpnFit,
int32_t* lpnDx,
void* lpSize);
]]
local gdi32 = ffi.load("gdi32")
-- gdi32.GetTextExtentExPointI(hdc, lpwszString, cwchString, nMaxExtent, lpnFit, lpnDx, lpSize)
-- hdc : HDC
-- lpwszString : WORD*
-- cwchString : INT
-- nMaxExtent : INT
-- lpnFit : INT* optional, out
-- lpnDx : INT* optional, out
-- lpSize : SIZE* out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('GDI32.dll');
const GetTextExtentExPointI = lib.func('__stdcall', 'GetTextExtentExPointI', 'int32_t', ['void *', 'uint16_t *', 'int32_t', 'int32_t', 'int32_t *', 'int32_t *', 'void *']);
// GetTextExtentExPointI(hdc, lpwszString, cwchString, nMaxExtent, lpnFit, lpnDx, lpSize)
// hdc : HDC -> 'void *'
// lpwszString : WORD* -> 'uint16_t *'
// cwchString : INT -> 'int32_t'
// nMaxExtent : INT -> 'int32_t'
// lpnFit : INT* optional, out -> 'int32_t *'
// lpnDx : INT* optional, out -> 'int32_t *'
// lpSize : SIZE* out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("GDI32.dll", {
GetTextExtentExPointI: { parameters: ["pointer", "pointer", "i32", "i32", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.GetTextExtentExPointI(hdc, lpwszString, cwchString, nMaxExtent, lpnFit, lpnDx, lpSize)
// hdc : HDC -> "pointer"
// lpwszString : WORD* -> "pointer"
// cwchString : INT -> "i32"
// nMaxExtent : INT -> "i32"
// lpnFit : INT* optional, out -> "pointer"
// lpnDx : INT* optional, out -> "pointer"
// lpSize : SIZE* out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GetTextExtentExPointI(
void* hdc,
uint16_t* lpwszString,
int32_t cwchString,
int32_t nMaxExtent,
int32_t* lpnFit,
int32_t* lpnDx,
void* lpSize);
C, "GDI32.dll");
// $ffi->GetTextExtentExPointI(hdc, lpwszString, cwchString, nMaxExtent, lpnFit, lpnDx, lpSize);
// hdc : HDC
// lpwszString : WORD*
// cwchString : INT
// nMaxExtent : INT
// lpnFit : INT* optional, out
// lpnDx : INT* optional, out
// lpSize : SIZE* out
// 構造体/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 Gdi32 extends StdCallLibrary {
Gdi32 INSTANCE = Native.load("gdi32", Gdi32.class);
boolean GetTextExtentExPointI(
Pointer hdc, // HDC
ShortByReference lpwszString, // WORD*
int cwchString, // INT
int nMaxExtent, // INT
IntByReference lpnFit, // INT* optional, out
IntByReference lpnDx, // INT* optional, out
Pointer lpSize // SIZE* out
);
}@[Link("gdi32")]
lib LibGDI32
fun GetTextExtentExPointI = GetTextExtentExPointI(
hdc : Void*, # HDC
lpwszString : UInt16*, # WORD*
cwchString : Int32, # INT
nMaxExtent : Int32, # INT
lpnFit : Int32*, # INT* optional, out
lpnDx : Int32*, # INT* optional, out
lpSize : SIZE* # SIZE* out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef GetTextExtentExPointINative = Int32 Function(Pointer<Void>, Pointer<Uint16>, Int32, Int32, Pointer<Int32>, Pointer<Int32>, Pointer<Void>);
typedef GetTextExtentExPointIDart = int Function(Pointer<Void>, Pointer<Uint16>, int, int, Pointer<Int32>, Pointer<Int32>, Pointer<Void>);
final GetTextExtentExPointI = DynamicLibrary.open('GDI32.dll')
.lookupFunction<GetTextExtentExPointINative, GetTextExtentExPointIDart>('GetTextExtentExPointI');
// hdc : HDC -> Pointer<Void>
// lpwszString : WORD* -> Pointer<Uint16>
// cwchString : INT -> Int32
// nMaxExtent : INT -> Int32
// lpnFit : INT* optional, out -> Pointer<Int32>
// lpnDx : INT* optional, out -> Pointer<Int32>
// lpSize : SIZE* out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GetTextExtentExPointI(
hdc: THandle; // HDC
lpwszString: Pointer; // WORD*
cwchString: Integer; // INT
nMaxExtent: Integer; // INT
lpnFit: Pointer; // INT* optional, out
lpnDx: Pointer; // INT* optional, out
lpSize: Pointer // SIZE* out
): BOOL; stdcall;
external 'GDI32.dll' name 'GetTextExtentExPointI';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GetTextExtentExPointI"
c_GetTextExtentExPointI :: Ptr () -> Ptr Word16 -> Int32 -> Int32 -> Ptr Int32 -> Ptr Int32 -> Ptr () -> IO CInt
-- hdc : HDC -> Ptr ()
-- lpwszString : WORD* -> Ptr Word16
-- cwchString : INT -> Int32
-- nMaxExtent : INT -> Int32
-- lpnFit : INT* optional, out -> Ptr Int32
-- lpnDx : INT* optional, out -> Ptr Int32
-- lpSize : SIZE* out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let gettextextentexpointi =
foreign "GetTextExtentExPointI"
((ptr void) @-> (ptr uint16_t) @-> int32_t @-> int32_t @-> (ptr int32_t) @-> (ptr int32_t) @-> (ptr void) @-> returning int32_t)
(* hdc : HDC -> (ptr void) *)
(* lpwszString : WORD* -> (ptr uint16_t) *)
(* cwchString : INT -> int32_t *)
(* nMaxExtent : INT -> int32_t *)
(* lpnFit : INT* optional, out -> (ptr int32_t) *)
(* lpnDx : INT* optional, out -> (ptr int32_t) *)
(* lpSize : SIZE* out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library gdi32 (t "GDI32.dll"))
(cffi:use-foreign-library gdi32)
(cffi:defcfun ("GetTextExtentExPointI" get-text-extent-ex-point-i :convention :stdcall) :int32
(hdc :pointer) ; HDC
(lpwsz-string :pointer) ; WORD*
(cwch-string :int32) ; INT
(n-max-extent :int32) ; INT
(lpn-fit :pointer) ; INT* optional, out
(lpn-dx :pointer) ; INT* optional, out
(lp-size :pointer)) ; SIZE* out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GetTextExtentExPointI = Win32::API::More->new('GDI32',
'BOOL GetTextExtentExPointI(HANDLE hdc, LPVOID lpwszString, int cwchString, int nMaxExtent, LPVOID lpnFit, LPVOID lpnDx, LPVOID lpSize)');
# my $ret = $GetTextExtentExPointI->Call($hdc, $lpwszString, $cwchString, $nMaxExtent, $lpnFit, $lpnDx, $lpSize);
# hdc : HDC -> HANDLE
# lpwszString : WORD* -> LPVOID
# cwchString : INT -> int
# nMaxExtent : INT -> int
# lpnFit : INT* optional, out -> LPVOID
# lpnDx : INT* optional, out -> LPVOID
# lpSize : SIZE* out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- f GetTextExtentPointW — 文字列を描画した際の寸法を取得する。
使用する型