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

GetContextPropertyList

関数
認識コンテキストが対応するプロパティ一覧を取得する。
DLLinkobjcore.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT GetContextPropertyList(
    HRECOCONTEXT hrc,
    DWORD* pcProperties,
    GUID* pPropertyGUIDS
);

パラメーター

名前方向説明
hrcHRECOCONTEXTin対象の認識コンテキストのハンドル(HRECOCONTEXT)。
pcPropertiesDWORD*inoutプロパティ数を入出力するポインタ。入力でバッファ容量、出力で実際の数。
pPropertyGUIDSGUID*inoutサポートするコンテキストプロパティのGUID配列を受け取るポインタ。NULLで個数のみ取得。

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

GetContextPropertyList = ctypes.windll.inkobjcore.GetContextPropertyList
GetContextPropertyList.restype = ctypes.c_int
GetContextPropertyList.argtypes = [
    wintypes.HANDLE,  # hrc : HRECOCONTEXT
    ctypes.POINTER(wintypes.DWORD),  # pcProperties : DWORD* in/out
    ctypes.c_void_p,  # pPropertyGUIDS : GUID* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	inkobjcore = windows.NewLazySystemDLL("inkobjcore.dll")
	procGetContextPropertyList = inkobjcore.NewProc("GetContextPropertyList")
)

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

extern "inkobjcore" fn GetContextPropertyList(
    hrc: ?*anyopaque, // HRECOCONTEXT
    pcProperties: [*c]u32, // DWORD* in/out
    pPropertyGUIDS: [*c]GUID // GUID* in/out
) callconv(std.os.windows.WINAPI) i32;
proc GetContextPropertyList(
    hrc: pointer,  # HRECOCONTEXT
    pcProperties: ptr uint32,  # DWORD* in/out
    pPropertyGUIDS: ptr GUID  # GUID* in/out
): int32 {.importc: "GetContextPropertyList", stdcall, dynlib: "inkobjcore.dll".}
pragma(lib, "inkobjcore");
extern(Windows)
int GetContextPropertyList(
    void* hrc,   // HRECOCONTEXT
    uint* pcProperties,   // DWORD* in/out
    GUID* pPropertyGUIDS   // GUID* in/out
);
ccall((:GetContextPropertyList, "inkobjcore.dll"), stdcall, Int32,
      (Ptr{Cvoid}, Ptr{UInt32}, Ptr{GUID}),
      hrc, pcProperties, pPropertyGUIDS)
# hrc : HRECOCONTEXT -> Ptr{Cvoid}
# pcProperties : DWORD* in/out -> Ptr{UInt32}
# pPropertyGUIDS : GUID* in/out -> Ptr{GUID}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t GetContextPropertyList(
    void* hrc,
    uint32_t* pcProperties,
    void* pPropertyGUIDS);
]]
local inkobjcore = ffi.load("inkobjcore")
-- inkobjcore.GetContextPropertyList(hrc, pcProperties, pPropertyGUIDS)
-- hrc : HRECOCONTEXT
-- pcProperties : DWORD* in/out
-- pPropertyGUIDS : GUID* in/out
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('inkobjcore.dll');
const GetContextPropertyList = lib.func('__stdcall', 'GetContextPropertyList', 'int32_t', ['void *', 'uint32_t *', 'void *']);
// GetContextPropertyList(hrc, pcProperties, pPropertyGUIDS)
// hrc : HRECOCONTEXT -> 'void *'
// pcProperties : DWORD* in/out -> 'uint32_t *'
// pPropertyGUIDS : GUID* in/out -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("inkobjcore.dll", {
  GetContextPropertyList: { parameters: ["pointer", "pointer", "pointer"], result: "i32" },
});
// lib.symbols.GetContextPropertyList(hrc, pcProperties, pPropertyGUIDS)
// hrc : HRECOCONTEXT -> "pointer"
// pcProperties : DWORD* in/out -> "pointer"
// pPropertyGUIDS : GUID* in/out -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t GetContextPropertyList(
    void* hrc,
    uint32_t* pcProperties,
    void* pPropertyGUIDS);
C, "inkobjcore.dll");
// $ffi->GetContextPropertyList(hrc, pcProperties, pPropertyGUIDS);
// hrc : HRECOCONTEXT
// pcProperties : DWORD* in/out
// pPropertyGUIDS : GUID* 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 GetContextPropertyList(
        Pointer hrc,   // HRECOCONTEXT
        IntByReference pcProperties,   // DWORD* in/out
        Pointer pPropertyGUIDS   // GUID* in/out
    );
}
@[Link("inkobjcore")]
lib Libinkobjcore
  fun GetContextPropertyList = GetContextPropertyList(
    hrc : Void*,   # HRECOCONTEXT
    pcProperties : UInt32*,   # DWORD* in/out
    pPropertyGUIDS : GUID*   # GUID* 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 GetContextPropertyListNative = Int32 Function(Pointer<Void>, Pointer<Uint32>, Pointer<Void>);
typedef GetContextPropertyListDart = int Function(Pointer<Void>, Pointer<Uint32>, Pointer<Void>);
final GetContextPropertyList = DynamicLibrary.open('inkobjcore.dll')
    .lookupFunction<GetContextPropertyListNative, GetContextPropertyListDart>('GetContextPropertyList');
// hrc : HRECOCONTEXT -> Pointer<Void>
// pcProperties : DWORD* in/out -> Pointer<Uint32>
// pPropertyGUIDS : GUID* in/out -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function GetContextPropertyList(
  hrc: THandle;   // HRECOCONTEXT
  pcProperties: Pointer;   // DWORD* in/out
  pPropertyGUIDS: PGUID   // GUID* in/out
): Integer; stdcall;
  external 'inkobjcore.dll' name 'GetContextPropertyList';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "GetContextPropertyList"
  c_GetContextPropertyList :: Ptr () -> Ptr Word32 -> Ptr () -> IO Int32
-- hrc : HRECOCONTEXT -> Ptr ()
-- pcProperties : DWORD* in/out -> Ptr Word32
-- pPropertyGUIDS : GUID* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let getcontextpropertylist =
  foreign "GetContextPropertyList"
    ((ptr void) @-> (ptr uint32_t) @-> (ptr void) @-> returning int32_t)
(* hrc : HRECOCONTEXT -> (ptr void) *)
(* pcProperties : DWORD* in/out -> (ptr uint32_t) *)
(* pPropertyGUIDS : GUID* in/out -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library inkobjcore (t "inkobjcore.dll"))
(cffi:use-foreign-library inkobjcore)

(cffi:defcfun ("GetContextPropertyList" get-context-property-list :convention :stdcall) :int32
  (hrc :pointer)   ; HRECOCONTEXT
  (pc-properties :pointer)   ; DWORD* in/out
  (p-property-guids :pointer))   ; GUID* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GetContextPropertyList = Win32::API::More->new('inkobjcore',
    'int GetContextPropertyList(HANDLE hrc, LPVOID pcProperties, LPVOID pPropertyGUIDS)');
# my $ret = $GetContextPropertyList->Call($hrc, $pcProperties, $pPropertyGUIDS);
# hrc : HRECOCONTEXT -> HANDLE
# pcProperties : DWORD* in/out -> LPVOID
# pPropertyGUIDS : GUID* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。