ホーム › UI.TabletPC › SetTextContext
SetTextContext
関数認識コンテキストに前後の文脈テキストを設定する。
シグネチャ
// inkobjcore.dll
#include <windows.h>
HRESULT SetTextContext(
HRECOCONTEXT hrc,
DWORD cwcBefore,
LPCWSTR pwcBefore,
DWORD cwcAfter,
LPCWSTR pwcAfter
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| hrc | HRECOCONTEXT | in |
| cwcBefore | DWORD | in |
| pwcBefore | LPCWSTR | in |
| cwcAfter | DWORD | in |
| pwcAfter | LPCWSTR | in |
戻り値の型: HRESULT
各言語での呼び出し定義
// inkobjcore.dll
#include <windows.h>
HRESULT SetTextContext(
HRECOCONTEXT hrc,
DWORD cwcBefore,
LPCWSTR pwcBefore,
DWORD cwcAfter,
LPCWSTR pwcAfter
);[DllImport("inkobjcore.dll", ExactSpelling = true)]
static extern int SetTextContext(
IntPtr hrc, // HRECOCONTEXT
uint cwcBefore, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string pwcBefore, // LPCWSTR
uint cwcAfter, // DWORD
[MarshalAs(UnmanagedType.LPWStr)] string pwcAfter // LPCWSTR
);<DllImport("inkobjcore.dll", ExactSpelling:=True)>
Public Shared Function SetTextContext(
hrc As IntPtr, ' HRECOCONTEXT
cwcBefore As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> pwcBefore As String, ' LPCWSTR
cwcAfter As UInteger, ' DWORD
<MarshalAs(UnmanagedType.LPWStr)> pwcAfter As String ' LPCWSTR
) As Integer
End Function' hrc : HRECOCONTEXT
' cwcBefore : DWORD
' pwcBefore : LPCWSTR
' cwcAfter : DWORD
' pwcAfter : LPCWSTR
Declare PtrSafe Function SetTextContext Lib "inkobjcore" ( _
ByVal hrc As LongPtr, _
ByVal cwcBefore As Long, _
ByVal pwcBefore As LongPtr, _
ByVal cwcAfter As Long, _
ByVal pwcAfter As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetTextContext = ctypes.windll.inkobjcore.SetTextContext
SetTextContext.restype = ctypes.c_int
SetTextContext.argtypes = [
wintypes.HANDLE, # hrc : HRECOCONTEXT
wintypes.DWORD, # cwcBefore : DWORD
wintypes.LPCWSTR, # pwcBefore : LPCWSTR
wintypes.DWORD, # cwcAfter : DWORD
wintypes.LPCWSTR, # pwcAfter : LPCWSTR
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('inkobjcore.dll')
SetTextContext = Fiddle::Function.new(
lib['SetTextContext'],
[
Fiddle::TYPE_VOIDP, # hrc : HRECOCONTEXT
-Fiddle::TYPE_INT, # cwcBefore : DWORD
Fiddle::TYPE_VOIDP, # pwcBefore : LPCWSTR
-Fiddle::TYPE_INT, # cwcAfter : DWORD
Fiddle::TYPE_VOIDP, # pwcAfter : LPCWSTR
],
Fiddle::TYPE_INT)#[link(name = "inkobjcore")]
extern "system" {
fn SetTextContext(
hrc: *mut core::ffi::c_void, // HRECOCONTEXT
cwcBefore: u32, // DWORD
pwcBefore: *const u16, // LPCWSTR
cwcAfter: u32, // DWORD
pwcAfter: *const u16 // LPCWSTR
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("inkobjcore.dll")]
public static extern int SetTextContext(IntPtr hrc, uint cwcBefore, [MarshalAs(UnmanagedType.LPWStr)] string pwcBefore, uint cwcAfter, [MarshalAs(UnmanagedType.LPWStr)] string pwcAfter);
"@
$api = Add-Type -MemberDefinition $sig -Name 'inkobjcore_SetTextContext' -Namespace Win32 -PassThru
# $api::SetTextContext(hrc, cwcBefore, pwcBefore, cwcAfter, pwcAfter)#uselib "inkobjcore.dll"
#func global SetTextContext "SetTextContext" sptr, sptr, sptr, sptr, sptr
; SetTextContext hrc, cwcBefore, pwcBefore, cwcAfter, pwcAfter ; 戻り値は stat
; hrc : HRECOCONTEXT -> "sptr"
; cwcBefore : DWORD -> "sptr"
; pwcBefore : LPCWSTR -> "sptr"
; cwcAfter : DWORD -> "sptr"
; pwcAfter : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "inkobjcore.dll"
#cfunc global SetTextContext "SetTextContext" sptr, int, wstr, int, wstr
; res = SetTextContext(hrc, cwcBefore, pwcBefore, cwcAfter, pwcAfter)
; hrc : HRECOCONTEXT -> "sptr"
; cwcBefore : DWORD -> "int"
; pwcBefore : LPCWSTR -> "wstr"
; cwcAfter : DWORD -> "int"
; pwcAfter : LPCWSTR -> "wstr"; HRESULT SetTextContext(HRECOCONTEXT hrc, DWORD cwcBefore, LPCWSTR pwcBefore, DWORD cwcAfter, LPCWSTR pwcAfter)
#uselib "inkobjcore.dll"
#cfunc global SetTextContext "SetTextContext" intptr, int, wstr, int, wstr
; res = SetTextContext(hrc, cwcBefore, pwcBefore, cwcAfter, pwcAfter)
; hrc : HRECOCONTEXT -> "intptr"
; cwcBefore : DWORD -> "int"
; pwcBefore : LPCWSTR -> "wstr"
; cwcAfter : DWORD -> "int"
; pwcAfter : LPCWSTR -> "wstr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
inkobjcore = windows.NewLazySystemDLL("inkobjcore.dll")
procSetTextContext = inkobjcore.NewProc("SetTextContext")
)
// hrc (HRECOCONTEXT), cwcBefore (DWORD), pwcBefore (LPCWSTR), cwcAfter (DWORD), pwcAfter (LPCWSTR)
r1, _, err := procSetTextContext.Call(
uintptr(hrc),
uintptr(cwcBefore),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwcBefore))),
uintptr(cwcAfter),
uintptr(unsafe.Pointer(windows.StringToUTF16Ptr(pwcAfter))),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction SetTextContext(
hrc: THandle; // HRECOCONTEXT
cwcBefore: DWORD; // DWORD
pwcBefore: PWideChar; // LPCWSTR
cwcAfter: DWORD; // DWORD
pwcAfter: PWideChar // LPCWSTR
): Integer; stdcall;
external 'inkobjcore.dll' name 'SetTextContext';result := DllCall("inkobjcore\SetTextContext"
, "Ptr", hrc ; HRECOCONTEXT
, "UInt", cwcBefore ; DWORD
, "WStr", pwcBefore ; LPCWSTR
, "UInt", cwcAfter ; DWORD
, "WStr", pwcAfter ; LPCWSTR
, "Int") ; return: HRESULT●SetTextContext(hrc, cwcBefore, pwcBefore, cwcAfter, pwcAfter) = DLL("inkobjcore.dll", "int SetTextContext(void*, dword, char*, dword, char*)")
# 呼び出し: SetTextContext(hrc, cwcBefore, pwcBefore, cwcAfter, pwcAfter)
# hrc : HRECOCONTEXT -> "void*"
# cwcBefore : DWORD -> "dword"
# pwcBefore : LPCWSTR -> "char*"
# cwcAfter : DWORD -> "dword"
# pwcAfter : LPCWSTR -> "char*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。