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

IsStringSupported

関数
認識エンジンが指定文字列を認識可能か判定する。
DLLinkobjcore.dll呼出規約winapi対応OSWindows XP 以降

シグネチャ

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

HRESULT IsStringSupported(
    HRECOCONTEXT hrc,
    DWORD wcString,
    LPCWSTR pwcString
);

パラメーター

名前方向説明
hrcHRECOCONTEXTin対象の認識コンテキストのハンドル(HRECOCONTEXT)。
wcStringDWORDin判定する文字列の文字数。
pwcStringLPCWSTRinエンジンが認識可能か確認する対象のワイド文字列。

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT IsStringSupported(
    HRECOCONTEXT hrc,
    DWORD wcString,
    LPCWSTR pwcString
);
[DllImport("inkobjcore.dll", ExactSpelling = true)]
static extern int IsStringSupported(
    IntPtr hrc,   // HRECOCONTEXT
    uint wcString,   // DWORD
    [MarshalAs(UnmanagedType.LPWStr)] string pwcString   // LPCWSTR
);
<DllImport("inkobjcore.dll", ExactSpelling:=True)>
Public Shared Function IsStringSupported(
    hrc As IntPtr,   ' HRECOCONTEXT
    wcString As UInteger,   ' DWORD
    <MarshalAs(UnmanagedType.LPWStr)> pwcString As String   ' LPCWSTR
) As Integer
End Function
' hrc : HRECOCONTEXT
' wcString : DWORD
' pwcString : LPCWSTR
Declare PtrSafe Function IsStringSupported Lib "inkobjcore" ( _
    ByVal hrc As LongPtr, _
    ByVal wcString As Long, _
    ByVal pwcString As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

IsStringSupported = ctypes.windll.inkobjcore.IsStringSupported
IsStringSupported.restype = ctypes.c_int
IsStringSupported.argtypes = [
    wintypes.HANDLE,  # hrc : HRECOCONTEXT
    wintypes.DWORD,  # wcString : DWORD
    wintypes.LPCWSTR,  # pwcString : LPCWSTR
]
require 'fiddle'
require 'fiddle/import'

lib = Fiddle.dlopen('inkobjcore.dll')
IsStringSupported = Fiddle::Function.new(
  lib['IsStringSupported'],
  [
    Fiddle::TYPE_VOIDP,  # hrc : HRECOCONTEXT
    -Fiddle::TYPE_INT,  # wcString : DWORD
    Fiddle::TYPE_VOIDP,  # pwcString : LPCWSTR
  ],
  Fiddle::TYPE_INT)
#[link(name = "inkobjcore")]
extern "system" {
    fn IsStringSupported(
        hrc: *mut core::ffi::c_void,  // HRECOCONTEXT
        wcString: u32,  // DWORD
        pwcString: *const u16  // LPCWSTR
    ) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.
$sig = @"
[DllImport("inkobjcore.dll")]
public static extern int IsStringSupported(IntPtr hrc, uint wcString, [MarshalAs(UnmanagedType.LPWStr)] string pwcString);
"@
$api = Add-Type -MemberDefinition $sig -Name 'inkobjcore_IsStringSupported' -Namespace Win32 -PassThru
# $api::IsStringSupported(hrc, wcString, pwcString)
#uselib "inkobjcore.dll"
#func global IsStringSupported "IsStringSupported" sptr, sptr, sptr
; IsStringSupported hrc, wcString, pwcString   ; 戻り値は stat
; hrc : HRECOCONTEXT -> "sptr"
; wcString : DWORD -> "sptr"
; pwcString : LPCWSTR -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。
#uselib "inkobjcore.dll"
#cfunc global IsStringSupported "IsStringSupported" sptr, int, wstr
; res = IsStringSupported(hrc, wcString, pwcString)
; hrc : HRECOCONTEXT -> "sptr"
; wcString : DWORD -> "int"
; pwcString : LPCWSTR -> "wstr"
; HRESULT IsStringSupported(HRECOCONTEXT hrc, DWORD wcString, LPCWSTR pwcString)
#uselib "inkobjcore.dll"
#cfunc global IsStringSupported "IsStringSupported" intptr, int, wstr
; res = IsStringSupported(hrc, wcString, pwcString)
; hrc : HRECOCONTEXT -> "intptr"
; wcString : DWORD -> "int"
; pwcString : LPCWSTR -> "wstr"
import (
	"golang.org/x/sys/windows"
	"unsafe"
)

var (
	inkobjcore = windows.NewLazySystemDLL("inkobjcore.dll")
	procIsStringSupported = inkobjcore.NewProc("IsStringSupported")
)

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

extern "inkobjcore" fn IsStringSupported(
    hrc: ?*anyopaque, // HRECOCONTEXT
    wcString: u32, // DWORD
    pwcString: [*c]const u16 // LPCWSTR
) callconv(std.os.windows.WINAPI) i32;
proc IsStringSupported(
    hrc: pointer,  # HRECOCONTEXT
    wcString: uint32,  # DWORD
    pwcString: WideCString  # LPCWSTR
): int32 {.importc: "IsStringSupported", stdcall, dynlib: "inkobjcore.dll".}
pragma(lib, "inkobjcore");
extern(Windows)
int IsStringSupported(
    void* hrc,   // HRECOCONTEXT
    uint wcString,   // DWORD
    const(wchar)* pwcString   // LPCWSTR
);
ccall((:IsStringSupported, "inkobjcore.dll"), stdcall, Int32,
      (Ptr{Cvoid}, UInt32, Cwstring),
      hrc, wcString, pwcString)
# hrc : HRECOCONTEXT -> Ptr{Cvoid}
# wcString : DWORD -> UInt32
# pwcString : LPCWSTR -> Cwstring
# stdcall は 32bit のみ意味を持つ(x64 では無視)。
local ffi = require("ffi")
ffi.cdef[[
int32_t IsStringSupported(
    void* hrc,
    uint32_t wcString,
    const uint16_t* pwcString);
]]
local inkobjcore = ffi.load("inkobjcore")
-- inkobjcore.IsStringSupported(hrc, wcString, pwcString)
-- hrc : HRECOCONTEXT
-- wcString : DWORD
-- pwcString : LPCWSTR
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
const koffi = require('koffi');
const lib = koffi.load('inkobjcore.dll');
const IsStringSupported = lib.func('__stdcall', 'IsStringSupported', 'int32_t', ['void *', 'uint32_t', 'str16']);
// IsStringSupported(hrc, wcString, pwcString)
// hrc : HRECOCONTEXT -> 'void *'
// wcString : DWORD -> 'uint32_t'
// pwcString : LPCWSTR -> 'str16'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。
const lib = Deno.dlopen("inkobjcore.dll", {
  IsStringSupported: { parameters: ["pointer", "u32", "buffer"], result: "i32" },
});
// lib.symbols.IsStringSupported(hrc, wcString, pwcString)
// hrc : HRECOCONTEXT -> "pointer"
// wcString : DWORD -> "u32"
// pwcString : LPCWSTR -> "buffer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。
<?php
$ffi = FFI::cdef(<<<C
int32_t IsStringSupported(
    void* hrc,
    uint32_t wcString,
    const uint16_t* pwcString);
C, "inkobjcore.dll");
// $ffi->IsStringSupported(hrc, wcString, pwcString);
// hrc : HRECOCONTEXT
// wcString : DWORD
// pwcString : LPCWSTR
// 構造体/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 IsStringSupported(
        Pointer hrc,   // HRECOCONTEXT
        int wcString,   // DWORD
        WString pwcString   // LPCWSTR
    );
}
@[Link("inkobjcore")]
lib Libinkobjcore
  fun IsStringSupported = IsStringSupported(
    hrc : Void*,   # HRECOCONTEXT
    wcString : UInt32,   # DWORD
    pwcString : UInt16*   # LPCWSTR
  ) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。
import 'dart:ffi';
import 'package:ffi/ffi.dart';

typedef IsStringSupportedNative = Int32 Function(Pointer<Void>, Uint32, Pointer<Utf16>);
typedef IsStringSupportedDart = int Function(Pointer<Void>, int, Pointer<Utf16>);
final IsStringSupported = DynamicLibrary.open('inkobjcore.dll')
    .lookupFunction<IsStringSupportedNative, IsStringSupportedDart>('IsStringSupported');
// hrc : HRECOCONTEXT -> Pointer<Void>
// wcString : DWORD -> Uint32
// pwcString : LPCWSTR -> Pointer<Utf16>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。
{$mode objfpc}{$H+}
function IsStringSupported(
  hrc: THandle;   // HRECOCONTEXT
  wcString: DWORD;   // DWORD
  pwcString: PWideChar   // LPCWSTR
): Integer; stdcall;
  external 'inkobjcore.dll' name 'IsStringSupported';
import Foreign
import Foreign.C.Types
import Foreign.C.String

foreign import stdcall safe "IsStringSupported"
  c_IsStringSupported :: Ptr () -> Word32 -> CWString -> IO Int32
-- hrc : HRECOCONTEXT -> Ptr ()
-- wcString : DWORD -> Word32
-- pwcString : LPCWSTR -> CWString
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。
open Ctypes
open Foreign

let isstringsupported =
  foreign "IsStringSupported"
    ((ptr void) @-> uint32_t @-> (ptr uint16_t) @-> returning int32_t)
(* hrc : HRECOCONTEXT -> (ptr void) *)
(* wcString : DWORD -> uint32_t *)
(* pwcString : LPCWSTR -> (ptr uint16_t) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)
(cffi:define-foreign-library inkobjcore (t "inkobjcore.dll"))
(cffi:use-foreign-library inkobjcore)

(cffi:defcfun ("IsStringSupported" is-string-supported :convention :stdcall) :int32
  (hrc :pointer)   ; HRECOCONTEXT
  (wc-string :uint32)   ; DWORD
  (pwc-string (:string :encoding :utf-16le)))   ; LPCWSTR
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。
use Win32::API;
my $IsStringSupported = Win32::API::More->new('inkobjcore',
    'int IsStringSupported(HANDLE hrc, DWORD wcString, LPCWSTR pwcString)');
# my $ret = $IsStringSupported->Call($hrc, $wcString, $pwcString);
# hrc : HRECOCONTEXT -> HANDLE
# wcString : DWORD -> DWORD
# pwcString : LPCWSTR -> LPCWSTR
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。