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