问题描述
我正在使用MFC中的演示生物公制项目
在msdn上我们有一些回调函数但是我们需要创建指向成员函数的指针如何操作。
出现此错误:
错误1错误C2440:'=':无法转换为'void(__stdcall CBioMetricApplicationDlg: :*)(PVOID,HRESULT,WINBIO_UNIT_ID,PWINBIO_BIR,SIZE_T,WINBIO_REJECT_DETAIL)'到'无效(__thiscall CBioMetricApplicationDlg :: *)(PVOID,HRESULT,WINBIO_UNIT_ID,PWINBIO_BIR,SIZE_T,WINBIO_REJECT_DETAIL)'
我尝试过:
//在头文件CBioMetricApplicationDlg.h中。 ..
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
);
VOID CALLBACK(CBioMetricApplicationDlg :: * pCaptureCallback)(
__in_opt PVOID CaptureCallbackContext,
__in HRESULT OperationStatus,
__in WINBIO_UNIT_ID UnitId,
__in_bcount(SampleSize)PWINBIO_BIR示例,
__在SIZE_T SampleSize中,
__in WINBIO_REJECT_DETAIL RejectDetail
);
//在cpp文件中CBioMetricApplicationDlg.cpp
//在OnInitDialog()
// TODO:在这里添加额外的初始化
pCaptureCallback =& CBioMetricApplicationDlg :: CaptureCallback;
I'm working on demo bio metric project in MFC
On msdn we have some callback functions but for use that we need to create pointer to member function how to do it.
Getting this error:
Error1error C2440: '=' : cannot convert from 'void (__stdcall CBioMetricApplicationDlg::* )(PVOID,HRESULT,WINBIO_UNIT_ID,PWINBIO_BIR,SIZE_T,WINBIO_REJECT_DETAIL)' to 'void (__thiscall CBioMetricApplicationDlg::* )(PVOID,HRESULT,WINBIO_UNIT_ID,PWINBIO_BIR,SIZE_T,WINBIO_REJECT_DETAIL)'
What I have tried:
// in header file CBioMetricApplicationDlg.h ... 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 ); VOID CALLBACK(CBioMetricApplicationDlg:: *pCaptureCallback) ( __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 );
// in cpp file CBioMetricApplicationDlg.cpp //in the OnInitDialog() // TODO: Add extra initialization here pCaptureCallback = &CBioMetricApplicationDlg::CaptureCallback;
这篇关于如何在MFC中创建指向回调函数的指针的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!