ホーム › Globalization › ScriptStringAnalyse
ScriptStringAnalyse
関数文字列を解析し描画用の状態オブジェクトを生成する。
シグネチャ
// USP10.dll
#include <windows.h>
HRESULT ScriptStringAnalyse(
HDC hdc,
const void* pString,
INT cString,
INT cGlyphs,
INT iCharset,
DWORD dwFlags,
INT iReqWidth,
SCRIPT_CONTROL* psControl, // optional
SCRIPT_STATE* psState, // optional
const INT* piDx, // optional
SCRIPT_TABDEF* pTabdef, // optional
const BYTE* pbInClass,
void** pssa
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hdc | HDC | in |
| pString | void* | in |
| cString | INT | in |
| cGlyphs | INT | in |
| iCharset | INT | in |
| dwFlags | DWORD | in |
| iReqWidth | INT | in |
| psControl | SCRIPT_CONTROL* | inoptional |
| psState | SCRIPT_STATE* | inoptional |
| piDx | INT* | inoptional |
| pTabdef | SCRIPT_TABDEF* | inoptional |
| pbInClass | BYTE* | in |
| pssa | void** | out |
戻り値の型: HRESULT
各言語での呼び出し定義
// USP10.dll
#include <windows.h>
HRESULT ScriptStringAnalyse(
HDC hdc,
const void* pString,
INT cString,
INT cGlyphs,
INT iCharset,
DWORD dwFlags,
INT iReqWidth,
SCRIPT_CONTROL* psControl, // optional
SCRIPT_STATE* psState, // optional
const INT* piDx, // optional
SCRIPT_TABDEF* pTabdef, // optional
const BYTE* pbInClass,
void** pssa
);[DllImport("USP10.dll", ExactSpelling = true)]
static extern int ScriptStringAnalyse(
IntPtr hdc, // HDC
IntPtr pString, // void*
int cString, // INT
int cGlyphs, // INT
int iCharset, // INT
uint dwFlags, // DWORD
int iReqWidth, // INT
IntPtr psControl, // SCRIPT_CONTROL* optional
IntPtr psState, // SCRIPT_STATE* optional
IntPtr piDx, // INT* optional
IntPtr pTabdef, // SCRIPT_TABDEF* optional
IntPtr pbInClass, // BYTE*
IntPtr pssa // void** out
);<DllImport("USP10.dll", ExactSpelling:=True)>
Public Shared Function ScriptStringAnalyse(
hdc As IntPtr, ' HDC
pString As IntPtr, ' void*
cString As Integer, ' INT
cGlyphs As Integer, ' INT
iCharset As Integer, ' INT
dwFlags As UInteger, ' DWORD
iReqWidth As Integer, ' INT
psControl As IntPtr, ' SCRIPT_CONTROL* optional
psState As IntPtr, ' SCRIPT_STATE* optional
piDx As IntPtr, ' INT* optional
pTabdef As IntPtr, ' SCRIPT_TABDEF* optional
pbInClass As IntPtr, ' BYTE*
pssa As IntPtr ' void** out
) As Integer
End Function' hdc : HDC
' pString : void*
' cString : INT
' cGlyphs : INT
' iCharset : INT
' dwFlags : DWORD
' iReqWidth : INT
' psControl : SCRIPT_CONTROL* optional
' psState : SCRIPT_STATE* optional
' piDx : INT* optional
' pTabdef : SCRIPT_TABDEF* optional
' pbInClass : BYTE*
' pssa : void** out
Declare PtrSafe Function ScriptStringAnalyse Lib "usp10" ( _
ByVal hdc As LongPtr, _
ByVal pString As LongPtr, _
ByVal cString As Long, _
ByVal cGlyphs As Long, _
ByVal iCharset As Long, _
ByVal dwFlags As Long, _
ByVal iReqWidth As Long, _
ByVal psControl As LongPtr, _
ByVal psState As LongPtr, _
ByVal piDx As LongPtr, _
ByVal pTabdef As LongPtr, _
ByVal pbInClass As LongPtr, _
ByVal pssa As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
ScriptStringAnalyse = ctypes.windll.usp10.ScriptStringAnalyse
ScriptStringAnalyse.restype = ctypes.c_int
ScriptStringAnalyse.argtypes = [
wintypes.HANDLE, # hdc : HDC
ctypes.POINTER(None), # pString : void*
ctypes.c_int, # cString : INT
ctypes.c_int, # cGlyphs : INT
ctypes.c_int, # iCharset : INT
wintypes.DWORD, # dwFlags : DWORD
ctypes.c_int, # iReqWidth : INT
ctypes.c_void_p, # psControl : SCRIPT_CONTROL* optional
ctypes.c_void_p, # psState : SCRIPT_STATE* optional
ctypes.POINTER(ctypes.c_int), # piDx : INT* optional
ctypes.c_void_p, # pTabdef : SCRIPT_TABDEF* optional
ctypes.POINTER(ctypes.c_ubyte), # pbInClass : BYTE*
ctypes.c_void_p, # pssa : void** out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('USP10.dll')
ScriptStringAnalyse = Fiddle::Function.new(
lib['ScriptStringAnalyse'],
[
Fiddle::TYPE_VOIDP, # hdc : HDC
Fiddle::TYPE_VOIDP, # pString : void*
Fiddle::TYPE_INT, # cString : INT
Fiddle::TYPE_INT, # cGlyphs : INT
Fiddle::TYPE_INT, # iCharset : INT
-Fiddle::TYPE_INT, # dwFlags : DWORD
Fiddle::TYPE_INT, # iReqWidth : INT
Fiddle::TYPE_VOIDP, # psControl : SCRIPT_CONTROL* optional
Fiddle::TYPE_VOIDP, # psState : SCRIPT_STATE* optional
Fiddle::TYPE_VOIDP, # piDx : INT* optional
Fiddle::TYPE_VOIDP, # pTabdef : SCRIPT_TABDEF* optional
Fiddle::TYPE_VOIDP, # pbInClass : BYTE*
Fiddle::TYPE_VOIDP, # pssa : void** out
],
Fiddle::TYPE_INT)#[link(name = "usp10")]
extern "system" {
fn ScriptStringAnalyse(
hdc: *mut core::ffi::c_void, // HDC
pString: *const (), // void*
cString: i32, // INT
cGlyphs: i32, // INT
iCharset: i32, // INT
dwFlags: u32, // DWORD
iReqWidth: i32, // INT
psControl: *mut SCRIPT_CONTROL, // SCRIPT_CONTROL* optional
psState: *mut SCRIPT_STATE, // SCRIPT_STATE* optional
piDx: *const i32, // INT* optional
pTabdef: *mut SCRIPT_TABDEF, // SCRIPT_TABDEF* optional
pbInClass: *const u8, // BYTE*
pssa: *mut *mut () // void** out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("USP10.dll")]
public static extern int ScriptStringAnalyse(IntPtr hdc, IntPtr pString, int cString, int cGlyphs, int iCharset, uint dwFlags, int iReqWidth, IntPtr psControl, IntPtr psState, IntPtr piDx, IntPtr pTabdef, IntPtr pbInClass, IntPtr pssa);
"@
$api = Add-Type -MemberDefinition $sig -Name 'USP10_ScriptStringAnalyse' -Namespace Win32 -PassThru
# $api::ScriptStringAnalyse(hdc, pString, cString, cGlyphs, iCharset, dwFlags, iReqWidth, psControl, psState, piDx, pTabdef, pbInClass, pssa)#uselib "USP10.dll"
#func global ScriptStringAnalyse "ScriptStringAnalyse" sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr, sptr
; ScriptStringAnalyse hdc, pString, cString, cGlyphs, iCharset, dwFlags, iReqWidth, varptr(psControl), varptr(psState), varptr(piDx), varptr(pTabdef), varptr(pbInClass), pssa ; 戻り値は stat
; hdc : HDC -> "sptr"
; pString : void* -> "sptr"
; cString : INT -> "sptr"
; cGlyphs : INT -> "sptr"
; iCharset : INT -> "sptr"
; dwFlags : DWORD -> "sptr"
; iReqWidth : INT -> "sptr"
; psControl : SCRIPT_CONTROL* optional -> "sptr"
; psState : SCRIPT_STATE* optional -> "sptr"
; piDx : INT* optional -> "sptr"
; pTabdef : SCRIPT_TABDEF* optional -> "sptr"
; pbInClass : BYTE* -> "sptr"
; pssa : void** out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "USP10.dll" #cfunc global ScriptStringAnalyse "ScriptStringAnalyse" sptr, sptr, int, int, int, int, int, var, var, var, var, var, sptr ; res = ScriptStringAnalyse(hdc, pString, cString, cGlyphs, iCharset, dwFlags, iReqWidth, psControl, psState, piDx, pTabdef, pbInClass, pssa) ; hdc : HDC -> "sptr" ; pString : void* -> "sptr" ; cString : INT -> "int" ; cGlyphs : INT -> "int" ; iCharset : INT -> "int" ; dwFlags : DWORD -> "int" ; iReqWidth : INT -> "int" ; psControl : SCRIPT_CONTROL* optional -> "var" ; psState : SCRIPT_STATE* optional -> "var" ; piDx : INT* optional -> "var" ; pTabdef : SCRIPT_TABDEF* optional -> "var" ; pbInClass : BYTE* -> "var" ; pssa : void** out -> "sptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "USP10.dll" #cfunc global ScriptStringAnalyse "ScriptStringAnalyse" sptr, sptr, int, int, int, int, int, sptr, sptr, sptr, sptr, sptr, sptr ; res = ScriptStringAnalyse(hdc, pString, cString, cGlyphs, iCharset, dwFlags, iReqWidth, varptr(psControl), varptr(psState), varptr(piDx), varptr(pTabdef), varptr(pbInClass), pssa) ; hdc : HDC -> "sptr" ; pString : void* -> "sptr" ; cString : INT -> "int" ; cGlyphs : INT -> "int" ; iCharset : INT -> "int" ; dwFlags : DWORD -> "int" ; iReqWidth : INT -> "int" ; psControl : SCRIPT_CONTROL* optional -> "sptr" ; psState : SCRIPT_STATE* optional -> "sptr" ; piDx : INT* optional -> "sptr" ; pTabdef : SCRIPT_TABDEF* optional -> "sptr" ; pbInClass : BYTE* -> "sptr" ; pssa : void** out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT ScriptStringAnalyse(HDC hdc, void* pString, INT cString, INT cGlyphs, INT iCharset, DWORD dwFlags, INT iReqWidth, SCRIPT_CONTROL* psControl, SCRIPT_STATE* psState, INT* piDx, SCRIPT_TABDEF* pTabdef, BYTE* pbInClass, void** pssa) #uselib "USP10.dll" #cfunc global ScriptStringAnalyse "ScriptStringAnalyse" intptr, intptr, int, int, int, int, int, var, var, var, var, var, intptr ; res = ScriptStringAnalyse(hdc, pString, cString, cGlyphs, iCharset, dwFlags, iReqWidth, psControl, psState, piDx, pTabdef, pbInClass, pssa) ; hdc : HDC -> "intptr" ; pString : void* -> "intptr" ; cString : INT -> "int" ; cGlyphs : INT -> "int" ; iCharset : INT -> "int" ; dwFlags : DWORD -> "int" ; iReqWidth : INT -> "int" ; psControl : SCRIPT_CONTROL* optional -> "var" ; psState : SCRIPT_STATE* optional -> "var" ; piDx : INT* optional -> "var" ; pTabdef : SCRIPT_TABDEF* optional -> "var" ; pbInClass : BYTE* -> "var" ; pssa : void** out -> "intptr" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT ScriptStringAnalyse(HDC hdc, void* pString, INT cString, INT cGlyphs, INT iCharset, DWORD dwFlags, INT iReqWidth, SCRIPT_CONTROL* psControl, SCRIPT_STATE* psState, INT* piDx, SCRIPT_TABDEF* pTabdef, BYTE* pbInClass, void** pssa) #uselib "USP10.dll" #cfunc global ScriptStringAnalyse "ScriptStringAnalyse" intptr, intptr, int, int, int, int, int, intptr, intptr, intptr, intptr, intptr, intptr ; res = ScriptStringAnalyse(hdc, pString, cString, cGlyphs, iCharset, dwFlags, iReqWidth, varptr(psControl), varptr(psState), varptr(piDx), varptr(pTabdef), varptr(pbInClass), pssa) ; hdc : HDC -> "intptr" ; pString : void* -> "intptr" ; cString : INT -> "int" ; cGlyphs : INT -> "int" ; iCharset : INT -> "int" ; dwFlags : DWORD -> "int" ; iReqWidth : INT -> "int" ; psControl : SCRIPT_CONTROL* optional -> "intptr" ; psState : SCRIPT_STATE* optional -> "intptr" ; piDx : INT* optional -> "intptr" ; pTabdef : SCRIPT_TABDEF* optional -> "intptr" ; pbInClass : BYTE* -> "intptr" ; pssa : void** out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
usp10 = windows.NewLazySystemDLL("USP10.dll")
procScriptStringAnalyse = usp10.NewProc("ScriptStringAnalyse")
)
// hdc (HDC), pString (void*), cString (INT), cGlyphs (INT), iCharset (INT), dwFlags (DWORD), iReqWidth (INT), psControl (SCRIPT_CONTROL* optional), psState (SCRIPT_STATE* optional), piDx (INT* optional), pTabdef (SCRIPT_TABDEF* optional), pbInClass (BYTE*), pssa (void** out)
r1, _, err := procScriptStringAnalyse.Call(
uintptr(hdc),
uintptr(pString),
uintptr(cString),
uintptr(cGlyphs),
uintptr(iCharset),
uintptr(dwFlags),
uintptr(iReqWidth),
uintptr(psControl),
uintptr(psState),
uintptr(piDx),
uintptr(pTabdef),
uintptr(pbInClass),
uintptr(pssa),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction ScriptStringAnalyse(
hdc: THandle; // HDC
pString: Pointer; // void*
cString: Integer; // INT
cGlyphs: Integer; // INT
iCharset: Integer; // INT
dwFlags: DWORD; // DWORD
iReqWidth: Integer; // INT
psControl: Pointer; // SCRIPT_CONTROL* optional
psState: Pointer; // SCRIPT_STATE* optional
piDx: Pointer; // INT* optional
pTabdef: Pointer; // SCRIPT_TABDEF* optional
pbInClass: Pointer; // BYTE*
pssa: Pointer // void** out
): Integer; stdcall;
external 'USP10.dll' name 'ScriptStringAnalyse';result := DllCall("USP10\ScriptStringAnalyse"
, "Ptr", hdc ; HDC
, "Ptr", pString ; void*
, "Int", cString ; INT
, "Int", cGlyphs ; INT
, "Int", iCharset ; INT
, "UInt", dwFlags ; DWORD
, "Int", iReqWidth ; INT
, "Ptr", psControl ; SCRIPT_CONTROL* optional
, "Ptr", psState ; SCRIPT_STATE* optional
, "Ptr", piDx ; INT* optional
, "Ptr", pTabdef ; SCRIPT_TABDEF* optional
, "Ptr", pbInClass ; BYTE*
, "Ptr", pssa ; void** out
, "Int") ; return: HRESULT●ScriptStringAnalyse(hdc, pString, cString, cGlyphs, iCharset, dwFlags, iReqWidth, psControl, psState, piDx, pTabdef, pbInClass, pssa) = DLL("USP10.dll", "int ScriptStringAnalyse(void*, void*, int, int, int, dword, int, void*, void*, void*, void*, void*, void*)")
# 呼び出し: ScriptStringAnalyse(hdc, pString, cString, cGlyphs, iCharset, dwFlags, iReqWidth, psControl, psState, piDx, pTabdef, pbInClass, pssa)
# hdc : HDC -> "void*"
# pString : void* -> "void*"
# cString : INT -> "int"
# cGlyphs : INT -> "int"
# iCharset : INT -> "int"
# dwFlags : DWORD -> "dword"
# iReqWidth : INT -> "int"
# psControl : SCRIPT_CONTROL* optional -> "void*"
# psState : SCRIPT_STATE* optional -> "void*"
# piDx : INT* optional -> "void*"
# pTabdef : SCRIPT_TABDEF* optional -> "void*"
# pbInClass : BYTE* -> "void*"
# pssa : void** out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。