ホーム › UI.TabletPC › GetBestResultString
GetBestResultString
関数認識結果の最有力文字列を取得する。
シグネチャ
// inkobjcore.dll
#include <windows.h>
HRESULT GetBestResultString(
HRECOCONTEXT hrc,
DWORD* pcSize,
LPWSTR pwcBestResult // optional
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hrc | HRECOCONTEXT | in |
| pcSize | DWORD* | inout |
| pwcBestResult | LPWSTR | outoptional |
戻り値の型: HRESULT
各言語での呼び出し定義
// inkobjcore.dll
#include <windows.h>
HRESULT GetBestResultString(
HRECOCONTEXT hrc,
DWORD* pcSize,
LPWSTR pwcBestResult // optional
);[DllImport("inkobjcore.dll", ExactSpelling = true)]
static extern int GetBestResultString(
IntPtr hrc, // HRECOCONTEXT
ref uint pcSize, // DWORD* in/out
[MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pwcBestResult // LPWSTR optional, out
);<DllImport("inkobjcore.dll", ExactSpelling:=True)>
Public Shared Function GetBestResultString(
hrc As IntPtr, ' HRECOCONTEXT
ByRef pcSize As UInteger, ' DWORD* in/out
<MarshalAs(UnmanagedType.LPWStr)> pwcBestResult As System.Text.StringBuilder ' LPWSTR optional, out
) As Integer
End Function' hrc : HRECOCONTEXT
' pcSize : DWORD* in/out
' pwcBestResult : LPWSTR optional, out
Declare PtrSafe Function GetBestResultString Lib "inkobjcore" ( _
ByVal hrc As LongPtr, _
ByRef pcSize As Long, _
ByVal pwcBestResult As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
GetBestResultString = ctypes.windll.inkobjcore.GetBestResultString
GetBestResultString.restype = ctypes.c_int
GetBestResultString.argtypes = [
wintypes.HANDLE, # hrc : HRECOCONTEXT
ctypes.POINTER(wintypes.DWORD), # pcSize : DWORD* in/out
wintypes.LPWSTR, # pwcBestResult : LPWSTR optional, out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('inkobjcore.dll')
GetBestResultString = Fiddle::Function.new(
lib['GetBestResultString'],
[
Fiddle::TYPE_VOIDP, # hrc : HRECOCONTEXT
Fiddle::TYPE_VOIDP, # pcSize : DWORD* in/out
Fiddle::TYPE_VOIDP, # pwcBestResult : LPWSTR optional, out
],
Fiddle::TYPE_INT)#[link(name = "inkobjcore")]
extern "system" {
fn GetBestResultString(
hrc: *mut core::ffi::c_void, // HRECOCONTEXT
pcSize: *mut u32, // DWORD* in/out
pwcBestResult: *mut u16 // LPWSTR optional, out
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("inkobjcore.dll")]
public static extern int GetBestResultString(IntPtr hrc, ref uint pcSize, [MarshalAs(UnmanagedType.LPWStr)] System.Text.StringBuilder pwcBestResult);
"@
$api = Add-Type -MemberDefinition $sig -Name 'inkobjcore_GetBestResultString' -Namespace Win32 -PassThru
# $api::GetBestResultString(hrc, pcSize, pwcBestResult)#uselib "inkobjcore.dll"
#func global GetBestResultString "GetBestResultString" sptr, sptr, sptr
; GetBestResultString hrc, varptr(pcSize), varptr(pwcBestResult) ; 戻り値は stat
; hrc : HRECOCONTEXT -> "sptr"
; pcSize : DWORD* in/out -> "sptr"
; pwcBestResult : LPWSTR optional, out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "inkobjcore.dll" #cfunc global GetBestResultString "GetBestResultString" sptr, var, var ; res = GetBestResultString(hrc, pcSize, pwcBestResult) ; hrc : HRECOCONTEXT -> "sptr" ; pcSize : DWORD* in/out -> "var" ; pwcBestResult : LPWSTR optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "inkobjcore.dll" #cfunc global GetBestResultString "GetBestResultString" sptr, sptr, sptr ; res = GetBestResultString(hrc, varptr(pcSize), varptr(pwcBestResult)) ; hrc : HRECOCONTEXT -> "sptr" ; pcSize : DWORD* in/out -> "sptr" ; pwcBestResult : LPWSTR optional, out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT GetBestResultString(HRECOCONTEXT hrc, DWORD* pcSize, LPWSTR pwcBestResult) #uselib "inkobjcore.dll" #cfunc global GetBestResultString "GetBestResultString" intptr, var, var ; res = GetBestResultString(hrc, pcSize, pwcBestResult) ; hrc : HRECOCONTEXT -> "intptr" ; pcSize : DWORD* in/out -> "var" ; pwcBestResult : LPWSTR optional, out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT GetBestResultString(HRECOCONTEXT hrc, DWORD* pcSize, LPWSTR pwcBestResult) #uselib "inkobjcore.dll" #cfunc global GetBestResultString "GetBestResultString" intptr, intptr, intptr ; res = GetBestResultString(hrc, varptr(pcSize), varptr(pwcBestResult)) ; hrc : HRECOCONTEXT -> "intptr" ; pcSize : DWORD* in/out -> "intptr" ; pwcBestResult : LPWSTR optional, out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
inkobjcore = windows.NewLazySystemDLL("inkobjcore.dll")
procGetBestResultString = inkobjcore.NewProc("GetBestResultString")
)
// hrc (HRECOCONTEXT), pcSize (DWORD* in/out), pwcBestResult (LPWSTR optional, out)
r1, _, err := procGetBestResultString.Call(
uintptr(hrc),
uintptr(pcSize),
uintptr(pwcBestResult),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction GetBestResultString(
hrc: THandle; // HRECOCONTEXT
pcSize: Pointer; // DWORD* in/out
pwcBestResult: PWideChar // LPWSTR optional, out
): Integer; stdcall;
external 'inkobjcore.dll' name 'GetBestResultString';result := DllCall("inkobjcore\GetBestResultString"
, "Ptr", hrc ; HRECOCONTEXT
, "Ptr", pcSize ; DWORD* in/out
, "Ptr", pwcBestResult ; LPWSTR optional, out
, "Int") ; return: HRESULT●GetBestResultString(hrc, pcSize, pwcBestResult) = DLL("inkobjcore.dll", "int GetBestResultString(void*, void*, char*)")
# 呼び出し: GetBestResultString(hrc, pcSize, pwcBestResult)
# hrc : HRECOCONTEXT -> "void*"
# pcSize : DWORD* in/out -> "void*"
# pwcBestResult : LPWSTR optional, out -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。