Win32 API 日本語リファレンス
ホームDevices.BiometricFramework › WinBioRegisterEventMonitor

WinBioRegisterEventMonitor

関数
生体認証イベントの通知用コールバックを登録する。
DLLwinbio.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT WinBioRegisterEventMonitor(
    DWORD SessionHandle,
    DWORD EventMask,
    PWINBIO_EVENT_CALLBACK EventCallback,
    void* EventCallbackContext   // optional
);

パラメーター

名前方向
SessionHandleDWORDin
EventMaskDWORDin
EventCallbackPWINBIO_EVENT_CALLBACKin
EventCallbackContextvoid*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

HRESULT WinBioRegisterEventMonitor(
    DWORD SessionHandle,
    DWORD EventMask,
    PWINBIO_EVENT_CALLBACK EventCallback,
    void* EventCallbackContext   // optional
);
[DllImport("winbio.dll", ExactSpelling = true)]
static extern int WinBioRegisterEventMonitor(
    uint SessionHandle,   // DWORD
    uint EventMask,   // DWORD
    IntPtr EventCallback,   // PWINBIO_EVENT_CALLBACK
    IntPtr EventCallbackContext   // void* optional
);
<DllImport("winbio.dll", ExactSpelling:=True)>
Public Shared Function WinBioRegisterEventMonitor(
    SessionHandle As UInteger,   ' DWORD
    EventMask As UInteger,   ' DWORD
    EventCallback As IntPtr,   ' PWINBIO_EVENT_CALLBACK
    EventCallbackContext As IntPtr   ' void* optional
) As Integer
End Function
' SessionHandle : DWORD
' EventMask : DWORD
' EventCallback : PWINBIO_EVENT_CALLBACK
' EventCallbackContext : void* optional
Declare PtrSafe Function WinBioRegisterEventMonitor Lib "winbio" ( _
    ByVal SessionHandle As Long, _
    ByVal EventMask As Long, _
    ByVal EventCallback As LongPtr, _
    ByVal EventCallbackContext As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。
import ctypes
from ctypes import wintypes

WinBioRegisterEventMonitor = ctypes.windll.winbio.WinBioRegisterEventMonitor
WinBioRegisterEventMonitor.restype = ctypes.c_int
WinBioRegisterEventMonitor.argtypes = [
    wintypes.DWORD,  # SessionHandle : DWORD
    wintypes.DWORD,  # EventMask : DWORD
    ctypes.c_void_p,  # EventCallback : PWINBIO_EVENT_CALLBACK
    ctypes.POINTER(None),  # EventCallbackContext : void* optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	winbio = windows.NewLazySystemDLL("winbio.dll")
	procWinBioRegisterEventMonitor = winbio.NewProc("WinBioRegisterEventMonitor")
)

// SessionHandle (DWORD), EventMask (DWORD), EventCallback (PWINBIO_EVENT_CALLBACK), EventCallbackContext (void* optional)
r1, _, err := procWinBioRegisterEventMonitor.Call(
	uintptr(SessionHandle),
	uintptr(EventMask),
	uintptr(EventCallback),
	uintptr(EventCallbackContext),
)
_ = err  // syscall.Errno (valid when the call sets last-error)
_ = r1   // HRESULT
function WinBioRegisterEventMonitor(
  SessionHandle: DWORD;   // DWORD
  EventMask: DWORD;   // DWORD
  EventCallback: Pointer;   // PWINBIO_EVENT_CALLBACK
  EventCallbackContext: Pointer   // void* optional
): Integer; stdcall;
  external 'winbio.dll' name 'WinBioRegisterEventMonitor';
result := DllCall("winbio\WinBioRegisterEventMonitor"
    , "UInt", SessionHandle   ; DWORD
    , "UInt", EventMask   ; DWORD
    , "Ptr", EventCallback   ; PWINBIO_EVENT_CALLBACK
    , "Ptr", EventCallbackContext   ; void* optional
    , "Int")   ; return: HRESULT
●WinBioRegisterEventMonitor(SessionHandle, EventMask, EventCallback, EventCallbackContext) = DLL("winbio.dll", "int WinBioRegisterEventMonitor(dword, dword, void*, void*)")
# 呼び出し: WinBioRegisterEventMonitor(SessionHandle, EventMask, EventCallback, EventCallbackContext)
# SessionHandle : DWORD -> "dword"
# EventMask : DWORD -> "dword"
# EventCallback : PWINBIO_EVENT_CALLBACK -> "void*"
# EventCallbackContext : void* optional -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。