WinBioAsyncMonitorFrameworkChanges
関数シグネチャ
// winbio.dll
#include <windows.h>
HRESULT WinBioAsyncMonitorFrameworkChanges(
DWORD FrameworkHandle,
DWORD ChangeTypes
);パラメーター
| 名前 | 型 | 方向 | 説明 | ||||
|---|---|---|---|---|---|---|---|
| FrameworkHandle | DWORD | in | WinBioAsyncOpenFramework を呼び出して開いたフレームワークセッションのハンドル。 | ||||
| ChangeTypes | DWORD | in | 非同期通知を生成する対象となるイベントの種類を示す WINBIO_FRAMEWORK_CHANGE_TYPE 型のフラグのビットマスク。Windows 8 以降では、次のフラグを使用できます。
|
戻り値の型: HRESULT
公式ドキュメント
バイオメトリックフレームワークへの変更を監視する非同期モニターを開始します。
戻り値
この関数は、成功または失敗を示す HRESULT を返します。成功は、関数の引数が有効であったことのみを示す点に注意してください。操作の実行中に発生した失敗は、WinBioAsyncOpenFramework で指定した通知方法を使用して、WINBIO_ASYNC_RESULT 構造体で非同期に返されます。
| 戻り値 | 説明 |
|---|---|
| FrameworkHandle 引数を設定する必要があります。 | |
| ChangeTypes パラメーターに指定されたビットマスクに、1 つ以上の無効な型ビットが含まれています。現在使用できる値は WINBIO_FRAMEWORK_CHANGE_UNIT のみです。 | |
| FrameworkHandle 引数は、非同期フレームワークセッションを表している必要があります。 |
解説(Remarks)
いったん開始されると、このモニターは、クライアントアプリケーションが WinBioCancel または WinBioCloseFramework を呼び出すまでイベントを生成し続けます。WINBIO_FRAMEWORK_CHANGE_UNIT イベント用のモニターを作成すると、次の 2 種類の非同期通知が生成されます。
| 値 | 意味 |
|---|---|
| WINBIO_OPERATION_UNIT_ARRIVAL | バイオメトリックユニットが接続されました。 |
| WINBIO_OPERATION_UNIT_REMOVAL | バイオメトリックユニットが取り外されました。 |
WinBioAsyncMonitorFrameworkChanges 関数は、WinBioAsyncOpenFramework を呼び出して開いたフレームワークセッションのハンドルを使用します。フレームワークは WINBIO_ASYNC_RESULT 構造体を割り当て、それを使用して操作の成否に関する情報を返します。バイオメトリックユニットがコンピューターに接続または取り外された場合、フレームワークは構造体の Operation メンバーを設定します。操作中に問題が発生した場合、フレームワークは WINBIO_ASYNC_RESULT 構造体を使用してエラー情報を返します。この構造体は、WinBioAsyncOpenFramework 関数の NotificationMethod パラメーターに設定した値に応じて、アプリケーションのコールバックまたはアプリケーションのメッセージキューに返されます。
- コールバックを使用して完了通知を受け取る場合は、PWINBIO_ASYNC_COMPLETION_CALLBACK 関数を実装し、NotificationMethod パラメーターに WINBIO_ASYNC_NOTIFY_CALLBACK を設定する必要があります。
- アプリケーションのメッセージキューを使用して完了通知を受け取る場合は、NotificationMethod パラメーターに WINBIO_ASYNC_NOTIFY_MESSAGE を設定する必要があります。フレームワークは、ウィンドウメッセージの LPARAM フィールドに WINBIO_ASYNC_RESULT ポインターを返します。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// winbio.dll
#include <windows.h>
HRESULT WinBioAsyncMonitorFrameworkChanges(
DWORD FrameworkHandle,
DWORD ChangeTypes
);[DllImport("winbio.dll", ExactSpelling = true)]
static extern int WinBioAsyncMonitorFrameworkChanges(
uint FrameworkHandle, // DWORD
uint ChangeTypes // DWORD
);<DllImport("winbio.dll", ExactSpelling:=True)>
Public Shared Function WinBioAsyncMonitorFrameworkChanges(
FrameworkHandle As UInteger, ' DWORD
ChangeTypes As UInteger ' DWORD
) As Integer
End Function' FrameworkHandle : DWORD
' ChangeTypes : DWORD
Declare PtrSafe Function WinBioAsyncMonitorFrameworkChanges Lib "winbio" ( _
ByVal FrameworkHandle As Long, _
ByVal ChangeTypes As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
WinBioAsyncMonitorFrameworkChanges = ctypes.windll.winbio.WinBioAsyncMonitorFrameworkChanges
WinBioAsyncMonitorFrameworkChanges.restype = ctypes.c_int
WinBioAsyncMonitorFrameworkChanges.argtypes = [
wintypes.DWORD, # FrameworkHandle : DWORD
wintypes.DWORD, # ChangeTypes : DWORD
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('winbio.dll')
WinBioAsyncMonitorFrameworkChanges = Fiddle::Function.new(
lib['WinBioAsyncMonitorFrameworkChanges'],
[
-Fiddle::TYPE_INT, # FrameworkHandle : DWORD
-Fiddle::TYPE_INT, # ChangeTypes : DWORD
],
Fiddle::TYPE_INT)#[link(name = "winbio")]
extern "system" {
fn WinBioAsyncMonitorFrameworkChanges(
FrameworkHandle: u32, // DWORD
ChangeTypes: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("winbio.dll")]
public static extern int WinBioAsyncMonitorFrameworkChanges(uint FrameworkHandle, uint ChangeTypes);
"@
$api = Add-Type -MemberDefinition $sig -Name 'winbio_WinBioAsyncMonitorFrameworkChanges' -Namespace Win32 -PassThru
# $api::WinBioAsyncMonitorFrameworkChanges(FrameworkHandle, ChangeTypes)#uselib "winbio.dll"
#func global WinBioAsyncMonitorFrameworkChanges "WinBioAsyncMonitorFrameworkChanges" sptr, sptr
; WinBioAsyncMonitorFrameworkChanges FrameworkHandle, ChangeTypes ; 戻り値は stat
; FrameworkHandle : DWORD -> "sptr"
; ChangeTypes : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "winbio.dll"
#cfunc global WinBioAsyncMonitorFrameworkChanges "WinBioAsyncMonitorFrameworkChanges" int, int
; res = WinBioAsyncMonitorFrameworkChanges(FrameworkHandle, ChangeTypes)
; FrameworkHandle : DWORD -> "int"
; ChangeTypes : DWORD -> "int"; HRESULT WinBioAsyncMonitorFrameworkChanges(DWORD FrameworkHandle, DWORD ChangeTypes)
#uselib "winbio.dll"
#cfunc global WinBioAsyncMonitorFrameworkChanges "WinBioAsyncMonitorFrameworkChanges" int, int
; res = WinBioAsyncMonitorFrameworkChanges(FrameworkHandle, ChangeTypes)
; FrameworkHandle : DWORD -> "int"
; ChangeTypes : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
winbio = windows.NewLazySystemDLL("winbio.dll")
procWinBioAsyncMonitorFrameworkChanges = winbio.NewProc("WinBioAsyncMonitorFrameworkChanges")
)
// FrameworkHandle (DWORD), ChangeTypes (DWORD)
r1, _, err := procWinBioAsyncMonitorFrameworkChanges.Call(
uintptr(FrameworkHandle),
uintptr(ChangeTypes),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // HRESULTfunction WinBioAsyncMonitorFrameworkChanges(
FrameworkHandle: DWORD; // DWORD
ChangeTypes: DWORD // DWORD
): Integer; stdcall;
external 'winbio.dll' name 'WinBioAsyncMonitorFrameworkChanges';result := DllCall("winbio\WinBioAsyncMonitorFrameworkChanges"
, "UInt", FrameworkHandle ; DWORD
, "UInt", ChangeTypes ; DWORD
, "Int") ; return: HRESULT●WinBioAsyncMonitorFrameworkChanges(FrameworkHandle, ChangeTypes) = DLL("winbio.dll", "int WinBioAsyncMonitorFrameworkChanges(dword, dword)")
# 呼び出し: WinBioAsyncMonitorFrameworkChanges(FrameworkHandle, ChangeTypes)
# FrameworkHandle : DWORD -> "dword"
# ChangeTypes : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "winbio" fn WinBioAsyncMonitorFrameworkChanges(
FrameworkHandle: u32, // DWORD
ChangeTypes: u32 // DWORD
) callconv(std.os.windows.WINAPI) i32;proc WinBioAsyncMonitorFrameworkChanges(
FrameworkHandle: uint32, # DWORD
ChangeTypes: uint32 # DWORD
): int32 {.importc: "WinBioAsyncMonitorFrameworkChanges", stdcall, dynlib: "winbio.dll".}pragma(lib, "winbio");
extern(Windows)
int WinBioAsyncMonitorFrameworkChanges(
uint FrameworkHandle, // DWORD
uint ChangeTypes // DWORD
);ccall((:WinBioAsyncMonitorFrameworkChanges, "winbio.dll"), stdcall, Int32,
(UInt32, UInt32),
FrameworkHandle, ChangeTypes)
# FrameworkHandle : DWORD -> UInt32
# ChangeTypes : DWORD -> UInt32
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
int32_t WinBioAsyncMonitorFrameworkChanges(
uint32_t FrameworkHandle,
uint32_t ChangeTypes);
]]
local winbio = ffi.load("winbio")
-- winbio.WinBioAsyncMonitorFrameworkChanges(FrameworkHandle, ChangeTypes)
-- FrameworkHandle : DWORD
-- ChangeTypes : DWORD
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('winbio.dll');
const WinBioAsyncMonitorFrameworkChanges = lib.func('__stdcall', 'WinBioAsyncMonitorFrameworkChanges', 'int32_t', ['uint32_t', 'uint32_t']);
// WinBioAsyncMonitorFrameworkChanges(FrameworkHandle, ChangeTypes)
// FrameworkHandle : DWORD -> 'uint32_t'
// ChangeTypes : DWORD -> 'uint32_t'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("winbio.dll", {
WinBioAsyncMonitorFrameworkChanges: { parameters: ["u32", "u32"], result: "i32" },
});
// lib.symbols.WinBioAsyncMonitorFrameworkChanges(FrameworkHandle, ChangeTypes)
// FrameworkHandle : DWORD -> "u32"
// ChangeTypes : DWORD -> "u32"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
int32_t WinBioAsyncMonitorFrameworkChanges(
uint32_t FrameworkHandle,
uint32_t ChangeTypes);
C, "winbio.dll");
// $ffi->WinBioAsyncMonitorFrameworkChanges(FrameworkHandle, ChangeTypes);
// FrameworkHandle : DWORD
// ChangeTypes : DWORD
// 構造体/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 Winbio extends StdCallLibrary {
Winbio INSTANCE = Native.load("winbio", Winbio.class);
int WinBioAsyncMonitorFrameworkChanges(
int FrameworkHandle, // DWORD
int ChangeTypes // DWORD
);
}@[Link("winbio")]
lib Libwinbio
fun WinBioAsyncMonitorFrameworkChanges = WinBioAsyncMonitorFrameworkChanges(
FrameworkHandle : UInt32, # DWORD
ChangeTypes : UInt32 # DWORD
) : Int32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef WinBioAsyncMonitorFrameworkChangesNative = Int32 Function(Uint32, Uint32);
typedef WinBioAsyncMonitorFrameworkChangesDart = int Function(int, int);
final WinBioAsyncMonitorFrameworkChanges = DynamicLibrary.open('winbio.dll')
.lookupFunction<WinBioAsyncMonitorFrameworkChangesNative, WinBioAsyncMonitorFrameworkChangesDart>('WinBioAsyncMonitorFrameworkChanges');
// FrameworkHandle : DWORD -> Uint32
// ChangeTypes : DWORD -> Uint32
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function WinBioAsyncMonitorFrameworkChanges(
FrameworkHandle: DWORD; // DWORD
ChangeTypes: DWORD // DWORD
): Integer; stdcall;
external 'winbio.dll' name 'WinBioAsyncMonitorFrameworkChanges';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "WinBioAsyncMonitorFrameworkChanges"
c_WinBioAsyncMonitorFrameworkChanges :: Word32 -> Word32 -> IO Int32
-- FrameworkHandle : DWORD -> Word32
-- ChangeTypes : DWORD -> Word32
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let winbioasyncmonitorframeworkchanges =
foreign "WinBioAsyncMonitorFrameworkChanges"
(uint32_t @-> uint32_t @-> returning int32_t)
(* FrameworkHandle : DWORD -> uint32_t *)
(* ChangeTypes : DWORD -> uint32_t *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library winbio (t "winbio.dll"))
(cffi:use-foreign-library winbio)
(cffi:defcfun ("WinBioAsyncMonitorFrameworkChanges" win-bio-async-monitor-framework-changes :convention :stdcall) :int32
(framework-handle :uint32) ; DWORD
(change-types :uint32)) ; DWORD
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $WinBioAsyncMonitorFrameworkChanges = Win32::API::More->new('winbio',
'int WinBioAsyncMonitorFrameworkChanges(DWORD FrameworkHandle, DWORD ChangeTypes)');
# my $ret = $WinBioAsyncMonitorFrameworkChanges->Call($FrameworkHandle, $ChangeTypes);
# FrameworkHandle : DWORD -> DWORD
# ChangeTypes : DWORD -> DWORD
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
- f WinBioAsyncOpenFramework — 生体認証フレームワークへの非同期接続ハンドルを開く。