ホーム › UI.TabletPC › GetContextPropertyValue
GetContextPropertyValue
関数認識コンテキストのプロパティ値を取得する。
シグネチャ
// inkobjcore.dll
#include <windows.h>
HRESULT GetContextPropertyValue(
HRECOCONTEXT hrc,
GUID* pGuid,
DWORD* pcbSize,
BYTE* pProperty
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| hrc | HRECOCONTEXT | in | 対象の認識コンテキストのハンドル(HRECOCONTEXT)。 |
| pGuid | GUID* | inout | 取得するプロパティを識別するGUIDへのポインタ。 |
| pcbSize | DWORD* | inout | サイズを入出力するポインタ。入力でバッファのバイト数、出力で必要または実際のバイト数。 |
| pProperty | BYTE* | inout | プロパティ値を受け取るバイトバッファへのポインタ。NULLで必要サイズのみ取得。 |
戻り値の型: HRESULT
各言語での呼び出し定義
// inkobjcore.dll
#include <windows.h>
HRESULT GetContextPropertyValue(
HRECOCONTEXT hrc,
GUID* pGuid,
DWORD* pcbSize,
BYTE* pProperty
);[DllImport("inkobjcore.dll", ExactSpelling = true)]
static extern int GetContextPropertyValue(
IntPtr hrc, // HRECOCONTEXT
ref Guid pGuid, // GUID* in/out
ref uint pcbSize, // DWORD* in/out
IntPtr pProperty // BYTE* in/out
);<DllImport("inkobjcore.dll", ExactSpelling:=True)>
Public Shared Function GetContextPropertyValue(
hrc As IntPtr, ' HRECOCONTEXT
ByRef pGuid As Guid, ' GUID* in/out
ByRef pcbSize As UInteger, ' DWORD* in/out
pProperty As IntPtr ' BYTE* in/out
) As Integer
End Function' hrc : HRECOCONTEXT
' pGuid : GUID* in/out
' pcbSize : DWORD* in/out
' pProperty : BYTE* in/out
Declare PtrSafe Function GetContextPropertyValue Lib "inkobjcore" ( _
ByVal hrc As LongPtr, _
ByVal pGuid As LongPtr, _
ByRef pcbSize 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
GetContextPropertyValue = ctypes.windll.inkobjcore.GetContextPropertyValue
GetContextPropertyValue.restype = ctypes.c_int
GetContextPropertyValue.argtypes = [
wintypes.HANDLE, # hrc : HRECOCONTEXT
ctypes.c_void_p, # pGuid : GUID* in/out
ctypes.POINTER(wintypes.DWORD), # pcbSize : DWORD* in/out
ctypes.POINTER(ctypes.c_ubyte), # pProperty : BYTE* in/out
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('inkobjcore.dll')
GetContextPropertyValue = Fiddle::Function.new(
lib['GetContextPropertyValue'],
[
Fiddle::TYPE_VOIDP, # hrc : HRECOCONTEXT
Fiddle::TYPE_VOIDP, # pGuid : GUID* in/out
Fiddle::TYPE_VOIDP, # pcbSize : DWORD* in/out
Fiddle::TYPE_VOIDP, # pProperty : BYTE* in/out
],
Fiddle::TYPE_INT)#[link(name = "inkobjcore")]
extern "system" {
fn GetContextPropertyValue(
hrc: *mut core::ffi::c_void, // HRECOCONTEXT
pGuid: *mut GUID, // GUID* in/out
pcbSize: *mut u32, // DWORD* in/out
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 GetContextPropertyValue(IntPtr hrc, ref Guid pGuid, ref uint pcbSize, IntPtr pProperty);
"@
$api = Add-Type -MemberDefinition $sig -Name 'inkobjcore_GetContextPropertyValue' -Namespace Win32 -PassThru
# $api::GetContextPropertyValue(hrc, pGuid, pcbSize, pProperty)#uselib "inkobjcore.dll"
#func global GetContextPropertyValue "GetContextPropertyValue" sptr, sptr, sptr, sptr
; GetContextPropertyValue hrc, varptr(pGuid), varptr(pcbSize), varptr(pProperty) ; 戻り値は stat
; hrc : HRECOCONTEXT -> "sptr"
; pGuid : GUID* in/out -> "sptr"
; pcbSize : DWORD* in/out -> "sptr"
; pProperty : BYTE* in/out -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。出力引数:
#uselib "inkobjcore.dll" #cfunc global GetContextPropertyValue "GetContextPropertyValue" sptr, var, var, var ; res = GetContextPropertyValue(hrc, pGuid, pcbSize, pProperty) ; hrc : HRECOCONTEXT -> "sptr" ; pGuid : GUID* in/out -> "var" ; pcbSize : DWORD* in/out -> "var" ; pProperty : BYTE* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。#uselib "inkobjcore.dll" #cfunc global GetContextPropertyValue "GetContextPropertyValue" sptr, sptr, sptr, sptr ; res = GetContextPropertyValue(hrc, varptr(pGuid), varptr(pcbSize), varptr(pProperty)) ; hrc : HRECOCONTEXT -> "sptr" ; pGuid : GUID* in/out -> "sptr" ; pcbSize : DWORD* in/out -> "sptr" ; pProperty : BYTE* in/out -> "sptr" ; ※出力/バッファ引数はポインタ方式(token=sptr / 呼び出しは varptr(変数))。
出力引数:
; HRESULT GetContextPropertyValue(HRECOCONTEXT hrc, GUID* pGuid, DWORD* pcbSize, BYTE* pProperty) #uselib "inkobjcore.dll" #cfunc global GetContextPropertyValue "GetContextPropertyValue" intptr, var, var, var ; res = GetContextPropertyValue(hrc, pGuid, pcbSize, pProperty) ; hrc : HRECOCONTEXT -> "intptr" ; pGuid : GUID* in/out -> "var" ; pcbSize : DWORD* in/out -> "var" ; pProperty : BYTE* in/out -> "var" ; ※出力/バッファ引数は var 方式(変数を直接渡す)。varptr 方式にも切替可。; HRESULT GetContextPropertyValue(HRECOCONTEXT hrc, GUID* pGuid, DWORD* pcbSize, BYTE* pProperty) #uselib "inkobjcore.dll" #cfunc global GetContextPropertyValue "GetContextPropertyValue" intptr, intptr, intptr, intptr ; res = GetContextPropertyValue(hrc, varptr(pGuid), varptr(pcbSize), varptr(pProperty)) ; hrc : HRECOCONTEXT -> "intptr" ; pGuid : GUID* in/out -> "intptr" ; pcbSize : DWORD* in/out -> "intptr" ; pProperty : BYTE* in/out -> "intptr" ; ※出力/バッファ引数はポインタ方式(token=intptr / 呼び出しは varptr(変数))。
import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
inkobjcore = windows.NewLazySystemDLL("inkobjcore.dll")
procGetContextPropertyValue = inkobjcore.NewProc("GetContextPropertyValue")
)
// hrc (HRECOCONTEXT), pGuid (GUID* in/out), pcbSize (DWORD* in/out), pProperty (BYTE* in/out)
r1, _, err := procGetContextPropertyValue.Call(
uintptr(hrc),
uintptr(pGuid),
uintptr(pcbSize),
uintptr(pProperty),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction GetContextPropertyValue(
hrc: THandle; // HRECOCONTEXT
pGuid: PGUID; // GUID* in/out
pcbSize: Pointer; // DWORD* in/out
pProperty: Pointer // BYTE* in/out
): Integer; stdcall;
external 'inkobjcore.dll' name 'GetContextPropertyValue';result := DllCall("inkobjcore\GetContextPropertyValue"
, "Ptr", hrc ; HRECOCONTEXT
, "Ptr", pGuid ; GUID* in/out
, "Ptr", pcbSize ; DWORD* in/out
, "Ptr", pProperty ; BYTE* in/out
, "Int") ; return: HRESULT●GetContextPropertyValue(hrc, pGuid, pcbSize, pProperty) = DLL("inkobjcore.dll", "int GetContextPropertyValue(void*, void*, void*, void*)")
# 呼び出し: GetContextPropertyValue(hrc, pGuid, pcbSize, pProperty)
# hrc : HRECOCONTEXT -> "void*"
# pGuid : GUID* in/out -> "void*"
# pcbSize : DWORD* in/out -> "void*"
# pProperty : BYTE* in/out -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "inkobjcore" fn GetContextPropertyValue(
hrc: ?*anyopaque, // HRECOCONTEXT
pGuid: [*c]GUID, // GUID* in/out
pcbSize: [*c]u32, // DWORD* in/out
pProperty: [*c]u8 // BYTE* in/out
) callconv(std.os.windows.WINAPI) i32;proc GetContextPropertyValue(
hrc: pointer, # HRECOCONTEXT
pGuid: ptr GUID, # GUID* in/out
pcbSize: ptr uint32, # DWORD* in/out
pProperty: ptr uint8 # BYTE* in/out
): int32 {.importc: "GetContextPropertyValue", stdcall, dynlib: "inkobjcore.dll".}pragma(lib, "inkobjcore");
extern(Windows)
int GetContextPropertyValue(
void* hrc, // HRECOCONTEXT
GUID* pGuid, // GUID* in/out
uint* pcbSize, // DWORD* in/out
ubyte* pProperty // BYTE* in/out
);ccall((:GetContextPropertyValue, "inkobjcore.dll"), stdcall, Int32,
(Ptr{Cvoid}, Ptr{GUID}, Ptr{UInt32}, Ptr{UInt8}),
hrc, pGuid, pcbSize, pProperty)
# hrc : HRECOCONTEXT -> Ptr{Cvoid}
# pGuid : GUID* in/out -> Ptr{GUID}
# pcbSize : DWORD* in/out -> Ptr{UInt32}
# pProperty : BYTE* in/out -> Ptr{UInt8}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t GetContextPropertyValue(
void* hrc,
void* pGuid,
uint32_t* pcbSize,
uint8_t* pProperty);
]]
local inkobjcore = ffi.load("inkobjcore")
-- inkobjcore.GetContextPropertyValue(hrc, pGuid, pcbSize, pProperty)
-- hrc : HRECOCONTEXT
-- pGuid : GUID* in/out
-- pcbSize : DWORD* in/out
-- pProperty : BYTE* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('inkobjcore.dll');
const GetContextPropertyValue = lib.func('__stdcall', 'GetContextPropertyValue', 'int32_t', ['void *', 'void *', 'uint32_t *', 'uint8_t *']);
// GetContextPropertyValue(hrc, pGuid, pcbSize, pProperty)
// hrc : HRECOCONTEXT -> 'void *'
// pGuid : GUID* in/out -> 'void *'
// pcbSize : DWORD* in/out -> 'uint32_t *'
// pProperty : BYTE* in/out -> 'uint8_t *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("inkobjcore.dll", {
GetContextPropertyValue: { parameters: ["pointer", "pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.GetContextPropertyValue(hrc, pGuid, pcbSize, pProperty)
// hrc : HRECOCONTEXT -> "pointer"
// pGuid : GUID* in/out -> "pointer"
// pcbSize : DWORD* in/out -> "pointer"
// pProperty : BYTE* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t GetContextPropertyValue(
void* hrc,
void* pGuid,
uint32_t* pcbSize,
uint8_t* pProperty);
C, "inkobjcore.dll");
// $ffi->GetContextPropertyValue(hrc, pGuid, pcbSize, pProperty);
// hrc : HRECOCONTEXT
// pGuid : GUID* in/out
// pcbSize : DWORD* in/out
// pProperty : BYTE* in/out
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Inkobjcore extends StdCallLibrary {
Inkobjcore INSTANCE = Native.load("inkobjcore", Inkobjcore.class);
int GetContextPropertyValue(
Pointer hrc, // HRECOCONTEXT
Pointer pGuid, // GUID* in/out
IntByReference pcbSize, // DWORD* in/out
byte[] pProperty // BYTE* in/out
);
}@[Link("inkobjcore")]
lib Libinkobjcore
fun GetContextPropertyValue = GetContextPropertyValue(
hrc : Void*, # HRECOCONTEXT
pGuid : GUID*, # GUID* in/out
pcbSize : UInt32*, # DWORD* in/out
pProperty : UInt8* # BYTE* in/out
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef GetContextPropertyValueNative = Int32 Function(Pointer<Void>, Pointer<Void>, Pointer<Uint32>, Pointer<Uint8>);
typedef GetContextPropertyValueDart = int Function(Pointer<Void>, Pointer<Void>, Pointer<Uint32>, Pointer<Uint8>);
final GetContextPropertyValue = DynamicLibrary.open('inkobjcore.dll')
.lookupFunction<GetContextPropertyValueNative, GetContextPropertyValueDart>('GetContextPropertyValue');
// hrc : HRECOCONTEXT -> Pointer<Void>
// pGuid : GUID* in/out -> Pointer<Void>
// pcbSize : DWORD* in/out -> Pointer<Uint32>
// pProperty : BYTE* in/out -> Pointer<Uint8>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function GetContextPropertyValue(
hrc: THandle; // HRECOCONTEXT
pGuid: PGUID; // GUID* in/out
pcbSize: Pointer; // DWORD* in/out
pProperty: Pointer // BYTE* in/out
): Integer; stdcall;
external 'inkobjcore.dll' name 'GetContextPropertyValue';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "GetContextPropertyValue"
c_GetContextPropertyValue :: Ptr () -> Ptr () -> Ptr Word32 -> Ptr Word8 -> IO Int32
-- hrc : HRECOCONTEXT -> Ptr ()
-- pGuid : GUID* in/out -> Ptr ()
-- pcbSize : DWORD* in/out -> Ptr Word32
-- pProperty : BYTE* in/out -> Ptr Word8
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let getcontextpropertyvalue =
foreign "GetContextPropertyValue"
((ptr void) @-> (ptr void) @-> (ptr uint32_t) @-> (ptr uint8_t) @-> returning int32_t)
(* hrc : HRECOCONTEXT -> (ptr void) *)
(* pGuid : GUID* in/out -> (ptr void) *)
(* pcbSize : DWORD* in/out -> (ptr uint32_t) *)
(* pProperty : BYTE* in/out -> (ptr uint8_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library inkobjcore (t "inkobjcore.dll"))
(cffi:use-foreign-library inkobjcore)
(cffi:defcfun ("GetContextPropertyValue" get-context-property-value :convention :stdcall) :int32
(hrc :pointer) ; HRECOCONTEXT
(p-guid :pointer) ; GUID* in/out
(pcb-size :pointer) ; DWORD* in/out
(p-property :pointer)) ; BYTE* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $GetContextPropertyValue = Win32::API::More->new('inkobjcore',
'int GetContextPropertyValue(HANDLE hrc, LPVOID pGuid, LPVOID pcbSize, LPVOID pProperty)');
# my $ret = $GetContextPropertyValue->Call($hrc, $pGuid, $pcbSize, $pProperty);
# hrc : HRECOCONTEXT -> HANDLE
# pGuid : GUID* in/out -> LPVOID
# pcbSize : DWORD* in/out -> LPVOID
# pProperty : BYTE* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。