Win32 API 日本語リファレンス
ホームUI.TabletPC › GetUnicodeRanges

GetUnicodeRanges

関数
認識エンジンが対応するUnicode範囲を取得する。
DLLinkobjcore.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT GetUnicodeRanges(
    HRECOGNIZER hrec,
    DWORD* pcRanges,
    CHARACTER_RANGE* pcr
);

パラメーター

名前方向
hrecHRECOGNIZERin
pcRangesDWORD*inout
pcrCHARACTER_RANGE*inout

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT GetUnicodeRanges(
    HRECOGNIZER hrec,
    DWORD* pcRanges,
    CHARACTER_RANGE* pcr
);
[DllImport("inkobjcore.dll", ExactSpelling = true)]
static extern int GetUnicodeRanges(
    IntPtr hrec,   // HRECOGNIZER
    ref uint pcRanges,   // DWORD* in/out
    IntPtr pcr   // CHARACTER_RANGE* in/out
);
<DllImport("inkobjcore.dll", ExactSpelling:=True)>
Public Shared Function GetUnicodeRanges(
    hrec As IntPtr,   ' HRECOGNIZER
    ByRef pcRanges As UInteger,   ' DWORD* in/out
    pcr As IntPtr   ' CHARACTER_RANGE* in/out
) As Integer
End Function
' hrec : HRECOGNIZER
' pcRanges : DWORD* in/out
' pcr : CHARACTER_RANGE* in/out
Declare PtrSafe Function GetUnicodeRanges Lib "inkobjcore" ( _
    ByVal hrec As LongPtr, _
    ByRef pcRanges As Long, _
    ByVal pcr As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetUnicodeRanges = ctypes.windll.inkobjcore.GetUnicodeRanges
GetUnicodeRanges.restype = ctypes.c_int
GetUnicodeRanges.argtypes = [
    wintypes.HANDLE,  # hrec : HRECOGNIZER
    ctypes.POINTER(wintypes.DWORD),  # pcRanges : DWORD* in/out
    ctypes.c_void_p,  # pcr : CHARACTER_RANGE* in/out
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('inkobjcore.dll')
GetUnicodeRanges = Fiddle::Function.new(
  lib['GetUnicodeRanges'],
  [
    Fiddle::TYPE_VOIDP,  # hrec : HRECOGNIZER
    Fiddle::TYPE_VOIDP,  # pcRanges : DWORD* in/out
    Fiddle::TYPE_VOIDP,  # pcr : CHARACTER_RANGE* in/out
  ],
  Fiddle::TYPE_INT)
#[link(name = "inkobjcore")]
extern "system" {
    fn GetUnicodeRanges(
        hrec: *mut core::ffi::c_void,  // HRECOGNIZER
        pcRanges: *mut u32,  // DWORD* in/out
        pcr: *mut CHARACTER_RANGE  // CHARACTER_RANGE* in/out
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("inkobjcore.dll")]
public static extern int GetUnicodeRanges(IntPtr hrec, ref uint pcRanges, IntPtr pcr);
"@
$api = Add-Type -MemberDefinition $sig -Name 'inkobjcore_GetUnicodeRanges' -Namespace Win32 -PassThru
# $api::GetUnicodeRanges(hrec, pcRanges, pcr)
#uselib "inkobjcore.dll"
#func global GetUnicodeRanges "GetUnicodeRanges" sptr, sptr, sptr
; GetUnicodeRanges hrec, varptr(pcRanges), varptr(pcr)   ; 戻り値は stat
; hrec : HRECOGNIZER -> "sptr"
; pcRanges : DWORD* in/out -> "sptr"
; pcr : CHARACTER_RANGE* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
出力引数:
#uselib "inkobjcore.dll"
#cfunc global GetUnicodeRanges "GetUnicodeRanges" sptr, var, var
; res = GetUnicodeRanges(hrec, pcRanges, pcr)
; hrec : HRECOGNIZER -> "sptr"
; pcRanges : DWORD* in/out -> "var"
; pcr : CHARACTER_RANGE* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
出力引数:
; HRESULT GetUnicodeRanges(HRECOGNIZER hrec, DWORD* pcRanges, CHARACTER_RANGE* pcr)
#uselib "inkobjcore.dll"
#cfunc global GetUnicodeRanges "GetUnicodeRanges" intptr, var, var
; res = GetUnicodeRanges(hrec, pcRanges, pcr)
; hrec : HRECOGNIZER -> "intptr"
; pcRanges : DWORD* in/out -> "var"
; pcr : CHARACTER_RANGE* in/out -> "var"
; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	inkobjcore = windows.NewLazySystemDLL("inkobjcore.dll")
	procGetUnicodeRanges = inkobjcore.NewProc("GetUnicodeRanges")
)

// hrec (HRECOGNIZER), pcRanges (DWORD* in/out), pcr (CHARACTER_RANGE* in/out)
r1, _, err := procGetUnicodeRanges.Call(
	uintptr(hrec),
	uintptr(pcRanges),
	uintptr(pcr),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function GetUnicodeRanges(
  hrec: THandle;   // HRECOGNIZER
  pcRanges: Pointer;   // DWORD* in/out
  pcr: Pointer   // CHARACTER_RANGE* in/out
): Integer; stdcall;
  external 'inkobjcore.dll' name 'GetUnicodeRanges';
result := DllCall("inkobjcore\GetUnicodeRanges"
    , "Ptr", hrec   ; HRECOGNIZER
    , "Ptr", pcRanges   ; DWORD* in/out
    , "Ptr", pcr   ; CHARACTER_RANGE* in/out
    , "Int")   ; return: HRESULT
●GetUnicodeRanges(hrec, pcRanges, pcr) = DLL("inkobjcore.dll", "int GetUnicodeRanges(void*, void*, void*)")
# 呼び出し: GetUnicodeRanges(hrec, pcRanges, pcr)
# hrec : HRECOGNIZER -> "void*"
# pcRanges : DWORD* in/out -> "void*"
# pcr : CHARACTER_RANGE* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。