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

usearch_getMatchedText

関数
一致した部分文字列のテキストを取得する。
DLLicuin.dll呼出規約cdecl

シグネチャ

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

INT usearch_getMatchedText(
    const UStringSearch* strsrch,
    WORD* result,
    INT resultCapacity,
    UErrorCode* status
);

パラメーター

名前方向
strsrchUStringSearch*in
resultWORD*inout
resultCapacityINTin
statusUErrorCode*inout

戻り値の型: INT

各言語での呼び出し定義

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

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

usearch_getMatchedText = ctypes.cdll.icuin.usearch_getMatchedText
usearch_getMatchedText.restype = ctypes.c_int
usearch_getMatchedText.argtypes = [
    ctypes.c_void_p,  # strsrch : UStringSearch*
    ctypes.POINTER(ctypes.c_ushort),  # result : WORD* in/out
    ctypes.c_int,  # resultCapacity : INT
    ctypes.c_void_p,  # status : UErrorCode* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('icuin.dll')
usearch_getMatchedText = Fiddle::Function.new(
  lib['usearch_getMatchedText'],
  [
    Fiddle::TYPE_VOIDP,  # strsrch : UStringSearch*
    Fiddle::TYPE_VOIDP,  # result : WORD* in/out
    Fiddle::TYPE_INT,  # resultCapacity : INT
    Fiddle::TYPE_VOIDP,  # status : UErrorCode* in/out
  ],
  Fiddle::TYPE_INT, Fiddle::Function::CDECL)
#[link(name = "icuin")]
extern "C" {
    fn usearch_getMatchedText(
        strsrch: *const isize,  // UStringSearch*
        result: *mut u16,  // WORD* in/out
        resultCapacity: i32,  // INT
        status: *mut i32  // UErrorCode* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("icuin.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int usearch_getMatchedText(ref IntPtr strsrch, ref ushort result, int resultCapacity, ref int status);
"@
$api = Add-Type -MemberDefinition $sig -Name 'icuin_usearch_getMatchedText' -Namespace Win32 -PassThru
# $api::usearch_getMatchedText(strsrch, result, resultCapacity, status)
#uselib "icuin.dll"
#func global usearch_getMatchedText "usearch_getMatchedText" sptr, sptr, sptr, sptr
; usearch_getMatchedText strsrch, varptr(result), resultCapacity, status   ; 戻り値は stat
; strsrch : UStringSearch* -> "sptr"
; result : WORD* in/out -> "sptr"
; resultCapacity : INT -> "sptr"
; status : UErrorCode* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "icuin.dll"
#cfunc global usearch_getMatchedText "usearch_getMatchedText" int, var, int, int
; res = usearch_getMatchedText(strsrch, result, resultCapacity, status)
; strsrch : UStringSearch* -> "int"
; result : WORD* in/out -> "var"
; resultCapacity : INT -> "int"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; INT usearch_getMatchedText(UStringSearch* strsrch, WORD* result, INT resultCapacity, UErrorCode* status)
#uselib "icuin.dll"
#cfunc global usearch_getMatchedText "usearch_getMatchedText" int, var, int, int
; res = usearch_getMatchedText(strsrch, result, resultCapacity, status)
; strsrch : UStringSearch* -> "int"
; result : WORD* in/out -> "var"
; resultCapacity : INT -> "int"
; status : UErrorCode* in/out -> "int"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	icuin = windows.NewLazySystemDLL("icuin.dll")
	procusearch_getMatchedText = icuin.NewProc("usearch_getMatchedText")
)

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