It is common to use a
typedef
for such functions because it makes it easier to declare pointers.
For your case see
PWINBIO_CAPTURE_CALLBACK function pointer (Windows)[
^]:
typedef VOID ( CALLBACK *PWINBIO_CAPTURE_CALLBACK)(
_In_opt_ PVOID CaptureCallbackContext,
_In_ HRESULT OperationStatus,
_In_ WINBIO_UNIT_ID UnitId,
_In_ PWINBIO_BIR Sample,
_In_ SIZE_T SampleSize,
_In_ WINBIO_REJECT_DETAIL RejectDetail
);
Then declare the variable as
PWINBIO_CAPTURE_CALLBACK pCaptureCallback;
[EDIT]
I was not sure how
CALLBACK
is resolved. But it seems that it does not contain
static
. Because callback functions must be static, the declaration as class member function must be
static VOID CALLBACK CaptureCallback(
__in_opt PVOID CaptureCallbackContext,
__in HRESULT OperationStatus,
__in WINBIO_UNIT_ID UnitId,
__in_bcount(SampleSize) PWINBIO_BIR Sample,
__in SIZE_T SampleSize,
__in WINBIO_REJECT_DETAIL RejectDetail
);
To get access to the class within the callback function pass
this
as context parameter:
hr = WinBioCaptureSampleWithCallback(
sessionHandle,
WINBIO_NO_PURPOSE_AVAILABLE,
WINBIO_DATA_FLAG_RAW,
CaptureSampleCallback,
this);
and cast the parameter in the callback function:
VOID CBioMetricApplicationDlg::CaptureCallback(
__in_opt PVOID CaptureCallbackContext,
__in HRESULT OperationStatus,
__in WINBIO_UNIT_ID UnitId,
__in_bcount(SampleSize) PWINBIO_BIR Sample,
__in SIZE_T SampleSize,
__in WINBIO_REJECT_DETAIL RejectDetail
)
{
CBioMetricApplicationDlg *pThis = reinterpret_cast<CBioMetricApplicationDlg*>(CaptureCallbackContext);
}
[/EDIT]