错误C2664:无法转换参数(指纹传感器检测)
error C2664 : cannot convert parameter ( fingerprint sensor detection)
我有这个错误,我找不到解决此问题。我应该更改哪个参数?我有这个错误。
error C2664: 'WinBioLocateSensorWithCallback' : cannot convert parameter 2 from 'void (__stdcall *)(void)' to 'PWINBIO_LOCATE_SENSOR_CALLBACK'
感谢您的帮助!
这是代码
#include <Windows.h>
#include <Conio.h>
#include <Stdio.h>
#include <WinBio.h>
VOID CALLBACK LocateSensorCallback();
HRESULT LocateSensorWithCallback(BOOL bCancel)
{
HRESULT hr = S_OK;
WINBIO_SESSION_HANDLE sessionHandle = NULL;
WINBIO_UNIT_ID unitId = 0;
// Connect to the system pool.
hr = WinBioOpenSession(
WINBIO_TYPE_FINGERPRINT, // Service provider
WINBIO_POOL_SYSTEM, // Pool type
WINBIO_FLAG_DEFAULT, // Configuration and access
NULL, // Array of biometric unit IDs
0, // Count of biometric unit IDs
NULL, // Database ID
&sessionHandle // [out] Session handle
);
if (FAILED(hr))
{
wprintf_s(L"n WinBioOpenSession failed. hr = 0x%xn", hr);
goto e_Exit;
}
wprintf_s(L"n Calling WinBioLocateSensorWithCallback.");
hr = WinBioLocateSensorWithCallback(
sessionHandle, // Open biometric session
LocateSensorCallback, // Callback function
NULL // Optional context
);
if (FAILED(hr))
{
wprintf_s(L"n WinBioLocateSensorWithCallback failed.");
wprintf_s(L"hr = 0x%xn", hr);
goto e_Exit;
}
wprintf_s(L"n Swipe the sensor ...n");
// Cancel the identification if the bCancel flag is set.
if (bCancel)
{
wprintf_s(L"n Starting CANCEL timer...n");
Sleep( 7000 );
wprintf_s(L"n Calling WinBioCanceln");
hr = WinBioCancel( sessionHandle );
if (FAILED(hr))
{
wprintf_s(L"n WinBioCancel failed. hr = 0x%xn", hr);
goto e_Exit;
}
}
// Wait for the asynchronous identification process to complete
// or be canceled.
hr = WinBioWait( sessionHandle );
if (FAILED(hr))
{
wprintf_s(L"n WinBioWait failed. hr = 0x%xn", hr);
}
e_Exit:
if (sessionHandle != NULL)
{
wprintf_s(L"n Closing the session.n");
hr = WinBioCloseSession(sessionHandle);
if (FAILED(hr))
{
wprintf_s(L"n WinBioCloseSession failed. hr = 0x%xn", hr);
}
sessionHandle = NULL;
}
wprintf_s(L"n Hit any key to exit...");
_getch();
return hr;
}
//------------------------------------------------------------------------
// The following function is the callback for
// WinBioLocateSensorWithCallback. The function filters the response
// from the biometric subsystem and writes a result to the console window.
//
VOID CALLBACK LocateSensorCallback(
__in_opt PVOID LocateCallbackContext,
__in HRESULT OperationStatus,
__in WINBIO_UNIT_ID UnitId
)
{
UNREFERENCED_PARAMETER(LocateCallbackContext);
wprintf_s(L"n LocateSensorCallback executing.");
// A sensor could not be located.
if (FAILED(OperationStatus))
{
wprintf_s(L"n LocateSensorCallback failed.");
wprintf_s(L"OperationStatus = 0x%xn", OperationStatus);
}
// A sensor was located.
else
{
wprintf_s(L"n Selected unit ID: %dn", UnitId);
}
}
void main()
{
LocateSensorWithCallback(1);
}
您的问题是您对LocateSensorCallback
的定义与WinBioLocateSensorWithCallback
函数期望的签名不符。
从
上更改顶部的前向声明VOID CALLBACK LocateSensorCallback();
匹配实际功能:
VOID CALLBACK LocateSensorCallback(
__in_opt PVOID LocateCallbackContext,
__in HRESULT OperationStatus,
__in WINBIO_UNIT_ID UnitId
);
相关文章:
- Android NDK传感器向事件队列报告奇怪的间隔
- 扩展光电二极管探测器以支持多个传感器
- 传感器值的阈值
- 无法获取webot::PositionSensor对象中位置传感器的值
- OpenSSL fips in C++ wrapper Library 如何?错误:指纹不匹配
- 同步两个具有不同帧速率的传感器
- POST Arduino 传感器值通过 Flask API 发送到本地 Sqlite db
- Arduino Si7021 温度和湿度传感器代码中的错误
- 通过串行端口从GPS传感器读取
- 如何固定从传感器获得的变量值
- 当机器人车用超声波传感器(C++)检测到物体时,停止机器人车
- 为电容式触摸传感器设置延迟以防止"double press"
- 什么是英特尔实感的等效传感器
- 校准和归一化来自多个温度传感器的读数的算法
- 使用带有 PIR 传感器的米利斯检测连续运动
- 如何在 c++ 中计算对象的哈希/校验和/指纹?
- 使用 Arduino 发送两种不同类型的传感器数据
- 如果继电器在 arduino 上是常闭的,超声波传感器不起作用
- 为什么我的Arduino代码用于运行蓝牙控制的机器人,障碍物传感器无法正常工作
- 错误C2664:无法转换参数(指纹传感器检测)