Win32 API 日本語リファレンス
ホームGlobalization › unum_setTextAttribute

unum_setTextAttribute

関数
数値フォーマッタのテキスト属性を設定する。
DLLicuin.dll呼出規約cdecl

シグネチャ

// icuin.dll
#include <windows.h>

void unum_setTextAttribute(
    void** fmt,
    UNumberFormatTextAttribute tag,
    const WORD* newValue,
    INT newValueLength,
    UErrorCode* status
);

パラメーター

名前方向
fmtvoid**inout
tagUNumberFormatTextAttributein
newValueWORD*in
newValueLengthINTin
statusUErrorCode*inout

戻り値の型: void

各言語での呼び出し定義

// icuin.dll
#include <windows.h>

void unum_setTextAttribute(
    void** fmt,
    UNumberFormatTextAttribute tag,
    const WORD* newValue,
    INT newValueLength,
    UErrorCode* status
);
[DllImport("icuin.dll", ExactSpelling = true, CallingConvention = CallingConvention.Cdecl)]
static extern void unum_setTextAttribute(
    IntPtr fmt,   // void** in/out
    int tag,   // UNumberFormatTextAttribute
    ref ushort newValue,   // WORD*
    int newValueLength,   // INT
    ref int status   // UErrorCode* in/out
);
<DllImport("icuin.dll", ExactSpelling:=True, CallingConvention:=CallingConvention.Cdecl)>
Public Shared Sub unum_setTextAttribute(
    fmt As IntPtr,   ' void** in/out
    tag As Integer,   ' UNumberFormatTextAttribute
    ByRef newValue As UShort,   ' WORD*
    newValueLength As Integer,   ' INT
    ByRef status As Integer   ' UErrorCode* in/out
)
End Sub
' fmt : void** in/out
' tag : UNumberFormatTextAttribute
' newValue : WORD*
' newValueLength : INT
' status : UErrorCode* in/out
Declare PtrSafe Sub unum_setTextAttribute Lib "icuin" ( _
    ByVal fmt As LongPtr, _
    ByVal tag As Long, _
    ByRef newValue As Integer, _
    ByVal newValueLength As Long, _
    ByRef status As Long)
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

unum_setTextAttribute = ctypes.cdll.icuin.unum_setTextAttribute
unum_setTextAttribute.restype = None
unum_setTextAttribute.argtypes = [
    ctypes.c_void_p,  # fmt : void** in/out
    ctypes.c_int,  # tag : UNumberFormatTextAttribute
    ctypes.POINTER(ctypes.c_ushort),  # newValue : WORD*
    ctypes.c_int,  # newValueLength : INT
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
unum_setTextAttribute = Fiddle::Function.new(
  lib['unum_setTextAttribute'],
  [
    Fiddle::TYPE_VOIDP,  # fmt : void** in/out
    Fiddle::TYPE_INT,  # tag : UNumberFormatTextAttribute
    Fiddle::TYPE_VOIDP,  # newValue : WORD*
    Fiddle::TYPE_INT,  # newValueLength : INT
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_VOID, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn unum_setTextAttribute(
        fmt: *mut *mut (),  // void** in/out
        tag: i32,  // UNumberFormatTextAttribute
        newValue: *const u16,  // WORD*
        newValueLength: i32,  // INT
        status: *mut i32  // UErrorCode* in/out
    );
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern void unum_setTextAttribute(IntPtr fmt, int tag, ref ushort newValue, int newValueLength, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_unum_setTextAttribute' -Namespace Win32 -PassThru
# $api::unum_setTextAttribute(fmt, tag, newValue, newValueLength, status)
#uselib "icuin.dll"
#func global unum_setTextAttribute "unum_setTextAttribute" sptr, sptr, sptr, sptr, sptr
; unum_setTextAttribute fmt, tag, varptr(newValue), newValueLength, status
; fmt : void** in/out -> "sptr"
; tag : UNumberFormatTextAttribute -> "sptr"
; newValue : WORD* -> "sptr"
; newValueLength : INT -> "sptr"
; status : UErrorCode* in/out -> "sptr"
出力引数:
#uselib "icuin.dll"
#func global unum_setTextAttribute "unum_setTextAttribute" sptr, int, var, int, int
; unum_setTextAttribute fmt, tag, newValue, newValueLength, status
; fmt : void** in/out -> "sptr"
; tag : UNumberFormatTextAttribute -> "int"
; newValue : WORD* -> "var"
; newValueLength : INT -> "int"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; void unum_setTextAttribute(void** fmt, UNumberFormatTextAttribute tag, WORD* newValue, INT newValueLength, UErrorCode* status)
#uselib "icuin.dll"
#func global unum_setTextAttribute "unum_setTextAttribute" intptr, int, var, int, int
; unum_setTextAttribute fmt, tag, newValue, newValueLength, status
; fmt : void** in/out -> "intptr"
; tag : UNumberFormatTextAttribute -> "int"
; newValue : WORD* -> "var"
; newValueLength : INT -> "int"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procunum_setTextAttribute = icuin.NewProc("unum_setTextAttribute")
)

// fmt (void** in/out), tag (UNumberFormatTextAttribute), newValue (WORD*), newValueLength (INT), status (UErrorCode* in/out)
r1, _, err := procunum_setTextAttribute.Call(
	uintptr(fmt),
	uintptr(tag),
	uintptr(newValue),
	uintptr(newValueLength),
	uintptr(status),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // void
procedure unum_setTextAttribute(
  fmt: Pointer;   // void** in/out
  tag: Integer;   // UNumberFormatTextAttribute
  newValue: Pointer;   // WORD*
  newValueLength: Integer;   // INT
  status: Pointer   // UErrorCode* in/out
); cdecl;
  external 'icuin.dll' name 'unum_setTextAttribute';
result := DllCall("icuin\unum_setTextAttribute"
    , "Ptr", fmt   ; void** in/out
    , "Int", tag   ; UNumberFormatTextAttribute
    , "Ptr", newValue   ; WORD*
    , "Int", newValueLength   ; INT
    , "Ptr", status   ; UErrorCode* in/out
    , "Cdecl Int")   ; return: void
●unum_setTextAttribute(fmt, tag, newValue, newValueLength, status) = DLL("icuin.dll", "int unum_setTextAttribute(void*, int, void*, int, void*)")
# 呼び出し: unum_setTextAttribute(fmt, tag, newValue, newValueLength, status)
# fmt : void** in/out -> "void*"
# tag : UNumberFormatTextAttribute -> "int"
# newValue : WORD* -> "void*"
# newValueLength : INT -> "int"
# status : UErrorCode* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。
# ※cdecl関数。DLL()宣言はstdcall前提。cdeclは EXEC_PTR(`cdecl`,…) を使用。