GetTextExtentExPoint

機能
指定の幅内に収まるテキストのバイト数、文字間隔を取得する
Declare Function GetTextExtentExPoint Lib "gdi32.dll" Alias "GetTextExtentExPointA" _
(ByVal hdc As Long, ByVal lpszStr As String, ByVal cchString As Long, _
ByVal nMaxExtent As Long, lpnFit As Long, alpDx As Any, lpSize As SIZE) As Long
Declare Function GetTextExtentExPoint Lib "gdi32.dll" Alias "GetTextExtentExPointA" _
(ByVal hdc As Integer, ByVal lpszStr As String, ByVal cchString As Integer, _
ByVal nMaxExtent As Integer, lpnFit As Integer, alpDx As Integer, lpSize As SIZE) As Integer

BOOL GetTextExtentExPoint(
HDC hdc,
LPCTSTR lpszStr,
int cchString,
int nMaxExtent,
LPINT lpnFit,
LPINT alpDx,
LPSIZE lpSize
);
引数
hdc

デバイスコンテキストのハンドル
lpszStr
文字列
cchString
同、バイト数
nMaxExtent
最大指定幅(単位:ピクセル)
lpnFit
(戻り値)バイト数
alpDx
(戻り値)各文字までの距離を受け取る長整数配列
lpSize
(戻り値)テキストの寸法を受け取るSIZE構造体
戻り値
正常終了のとき                          0以外
エラーのとき                            0
備考
lpnFitにはバイト数が戻るので、2バイト文字が混在する場合は
2バイト文字の1バイト目のバイト数を示す場合がある。