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

SetContextPropertyValue

関数
認識コンテキストのプロパティ値を設定する。
DLLinkobjcore.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT SetContextPropertyValue(
    HRECOCONTEXT hrc,
    GUID* pGuid,
    DWORD cbSize,
    BYTE* pProperty
);

パラメーター

名前方向
hrcHRECOCONTEXTin
pGuidGUID*inout
cbSizeDWORDin
pPropertyBYTE*inout

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

SetContextPropertyValue = ctypes.windll.inkobjcore.SetContextPropertyValue
SetContextPropertyValue.restype = ctypes.c_int
SetContextPropertyValue.argtypes = [
    wintypes.HANDLE,  # hrc : HRECOCONTEXT
    ctypes.c_void_p,  # pGuid : GUID* in/out
    wintypes.DWORD,  # cbSize : DWORD
    ctypes.POINTER(ctypes.c_ubyte),  # pProperty : BYTE* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	inkobjcore = windows.NewLazySystemDLL("inkobjcore.dll")
	procSetContextPropertyValue = inkobjcore.NewProc("SetContextPropertyValue")
)

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