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

AddWordsToWordList

関数
認識用の単語リストに単語を追加する。
DLLinkobjcore.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT AddWordsToWordList(
    HRECOWORDLIST hwl,
    LPWSTR pwcWords
);

パラメーター

名前方向
hwlHRECOWORDLISTin
pwcWordsLPWSTRin

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT AddWordsToWordList(
    HRECOWORDLIST hwl,
    LPWSTR pwcWords
);
[DllImport("inkobjcore.dll", ExactSpelling = true)]
static extern int AddWordsToWordList(
    IntPtr hwl,   // HRECOWORDLIST
    [MarshalAs(UnmanagedType.LPWStr)] string pwcWords   // LPWSTR
);
<DllImport("inkobjcore.dll", ExactSpelling:=True)>
Public Shared Function AddWordsToWordList(
    hwl As IntPtr,   ' HRECOWORDLIST
    <MarshalAs(UnmanagedType.LPWStr)> pwcWords As String   ' LPWSTR
) As Integer
End Function
' hwl : HRECOWORDLIST
' pwcWords : LPWSTR
Declare PtrSafe Function AddWordsToWordList Lib "inkobjcore" ( _
    ByVal hwl As LongPtr, _
    ByVal pwcWords As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

AddWordsToWordList = ctypes.windll.inkobjcore.AddWordsToWordList
AddWordsToWordList.restype = ctypes.c_int
AddWordsToWordList.argtypes = [
    wintypes.HANDLE,  # hwl : HRECOWORDLIST
    wintypes.LPCWSTR,  # pwcWords : LPWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('inkobjcore.dll')
AddWordsToWordList = Fiddle::Function.new(
  lib['AddWordsToWordList'],
  [
    Fiddle::TYPE_VOIDP,  # hwl : HRECOWORDLIST
    Fiddle::TYPE_VOIDP,  # pwcWords : LPWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "inkobjcore")]
extern "system" {
    fn AddWordsToWordList(
        hwl: *mut core::ffi::c_void,  // HRECOWORDLIST
        pwcWords: *mut u16  // LPWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("inkobjcore.dll")]
public static extern int AddWordsToWordList(IntPtr hwl, [MarshalAs(UnmanagedType.LPWStr)] string pwcWords);
"@
$api = Add-Type -MemberDefinition $sig -Name 'inkobjcore_AddWordsToWordList' -Namespace Win32 -PassThru
# $api::AddWordsToWordList(hwl, pwcWords)
#uselib "inkobjcore.dll"
#func global AddWordsToWordList "AddWordsToWordList" sptr, sptr
; AddWordsToWordList hwl, pwcWords   ; 戻り値は stat
; hwl : HRECOWORDLIST -> "sptr"
; pwcWords : LPWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "inkobjcore.dll"
#cfunc global AddWordsToWordList "AddWordsToWordList" sptr, wstr
; res = AddWordsToWordList(hwl, pwcWords)
; hwl : HRECOWORDLIST -> "sptr"
; pwcWords : LPWSTR -> "wstr"
; HRESULT AddWordsToWordList(HRECOWORDLIST hwl, LPWSTR pwcWords)
#uselib "inkobjcore.dll"
#cfunc global AddWordsToWordList "AddWordsToWordList" intptr, wstr
; res = AddWordsToWordList(hwl, pwcWords)
; hwl : HRECOWORDLIST -> "intptr"
; pwcWords : LPWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	inkobjcore = windows.NewLazySystemDLL("inkobjcore.dll")
	procAddWordsToWordList = inkobjcore.NewProc("AddWordsToWordList")
)

// hwl (HRECOWORDLIST), pwcWords (LPWSTR)
r1, _, err := procAddWordsToWordList.Call(
	uintptr(hwl),
	uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwcWords))),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function AddWordsToWordList(
  hwl: THandle;   // HRECOWORDLIST
  pwcWords: PWideChar   // LPWSTR
): Integer; stdcall;
  external 'inkobjcore.dll' name 'AddWordsToWordList';
result := DllCall("inkobjcore\AddWordsToWordList"
    , "Ptr", hwl   ; HRECOWORDLIST
    , "WStr", pwcWords   ; LPWSTR
    , "Int")   ; return: HRESULT
●AddWordsToWordList(hwl, pwcWords) = DLL("inkobjcore.dll", "int AddWordsToWordList(void*, char*)")
# 呼び出し: AddWordsToWordList(hwl, pwcWords)
# hwl : HRECOWORDLIST -> "void*"
# pwcWords : LPWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。