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

WinBioEnrollCaptureWithCallback

関数
コールバック方式で登録用の生体サンプルを採取する。
DLLwinbio.dll呼出規約winapi対応OSWindows 7 以降

シグネチャ

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

HRESULT WinBioEnrollCaptureWithCallback(
    DWORD SessionHandle,
    PWINBIO_ENROLL_CAPTURE_CALLBACK EnrollCallback,
    void* EnrollCallbackContext   // optional
);

パラメーター

名前方向
SessionHandleDWORDin
EnrollCallbackPWINBIO_ENROLL_CAPTURE_CALLBACKin
EnrollCallbackContextvoid*inoptional

戻り値の型: HRESULT

各言語での呼び出し定義

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

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

WinBioEnrollCaptureWithCallback = ctypes.windll.winbio.WinBioEnrollCaptureWithCallback
WinBioEnrollCaptureWithCallback.restype = ctypes.c_int
WinBioEnrollCaptureWithCallback.argtypes = [
    wintypes.DWORD,  # SessionHandle : DWORD
    ctypes.c_void_p,  # EnrollCallback : PWINBIO_ENROLL_CAPTURE_CALLBACK
    ctypes.POINTER(None),  # EnrollCallbackContext : void* optional
]
require 'fiddle'
require 'fiddle/import'

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

var (
	winbio = windows.NewLazySystemDLL("winbio.dll")
	procWinBioEnrollCaptureWithCallback = winbio.NewProc("WinBioEnrollCaptureWithCallback")
)

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