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

GetRecoAttributes

関数
手書き認識エンジンの属性情報を取得する。
DLLinkobjcore.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT GetRecoAttributes(
    HRECOGNIZER hrec,
    RECO_ATTRS* pRecoAttrs
);

パラメーター

名前方向説明
hrecHRECOGNIZERin属性を取得する認識エンジンのハンドル(HRECOGNIZER)。
pRecoAttrsRECO_ATTRS*inoutエンジンの属性情報を受け取るRECO_ATTRS構造体へのポインタ。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT GetRecoAttributes(
    HRECOGNIZER hrec,
    RECO_ATTRS* pRecoAttrs
);
[DllImport("inkobjcore.dll", ExactSpelling = true)]
static extern int GetRecoAttributes(
    IntPtr hrec,   // HRECOGNIZER
    IntPtr pRecoAttrs   // RECO_ATTRS* in/out
);
<DllImport("inkobjcore.dll", ExactSpelling:=True)>
Public Shared Function GetRecoAttributes(
    hrec As IntPtr,   ' HRECOGNIZER
    pRecoAttrs As IntPtr   ' RECO_ATTRS* in/out
) As Integer
End Function
' hrec : HRECOGNIZER
' pRecoAttrs : RECO_ATTRS* in/out
Declare PtrSafe Function GetRecoAttributes Lib "inkobjcore" ( _
    ByVal hrec As LongPtr, _
    ByVal pRecoAttrs As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

GetRecoAttributes = ctypes.windll.inkobjcore.GetRecoAttributes
GetRecoAttributes.restype = ctypes.c_int
GetRecoAttributes.argtypes = [
    wintypes.HANDLE,  # hrec : HRECOGNIZER
    ctypes.c_void_p,  # pRecoAttrs : RECO_ATTRS* in/out
]
require 'fiddle'
require 'fiddle/import'

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

var (
	inkobjcore = windows.NewLazySystemDLL("inkobjcore.dll")
	procGetRecoAttributes = inkobjcore.NewProc("GetRecoAttributes")
)

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

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

foreign import stdcall safe "GetRecoAttributes"
  c_GetRecoAttributes :: Ptr () -> Ptr () -> IO Int32
-- hrec : HRECOGNIZER -> Ptr ()
-- pRecoAttrs : RECO_ATTRS* in/out -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let getrecoattributes =
  foreign "GetRecoAttributes"
    ((ptr void) @-> (ptr void) @-> returning int32_t)
(* hrec : HRECOGNIZER -> (ptr void) *)
(* pRecoAttrs : RECO_ATTRS* 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 ("GetRecoAttributes" get-reco-attributes :convention :stdcall) :int32
  (hrec :pointer)   ; HRECOGNIZER
  (p-reco-attrs :pointer))   ; RECO_ATTRS* in/out
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $GetRecoAttributes = Win32::API::More->new('inkobjcore',
    'int GetRecoAttributes(HANDLE hrec, LPVOID pRecoAttrs)');
# my $ret = $GetRecoAttributes->Call($hrec, $pRecoAttrs);
# hrec : HRECOGNIZER -> HANDLE
# pRecoAttrs : RECO_ATTRS* in/out -> LPVOID
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。

関連項目

使用する型