2013-07-21 48 views
0

我在編譯本教程時遇到了一些困難:msdn:http://msdn.microsoft.com/en-us/library/windows/desktop/ee207405(v=vs.85).aspx。正如標題所說,我甚至聯用DUMPBIN產生winbio.lib和LIB在VS 2008中的命令後,得到在編譯時沒有這樣的文件或目錄,這是代碼:Winbio.h沒有這樣的文件或目錄錯誤

#include <iostream> 
#include <Windows.h> 
#include <Stdio.h> 
#include <Conio.h> 
#include <Winbio.h> 

HRESULT CaptureSample(); 

int main(int argc, char** argv) { 
HRESULT CaptureSample(); 
return 0; 
} 
    HRESULT CaptureSample() 
{ 
HRESULT hr = S_OK; 
WINBIO_SESSION_HANDLE sessionHandle = NULL; 
WINBIO_UNIT_ID unitId = 0; 
WINBIO_REJECT_DETAIL rejectDetail = 0; 
PWINBIO_BIR sample = NULL; 
SIZE_T sampleSize = 0; 

// Connect to the system pool. 
hr = WinBioOpenSession( 
     WINBIO_TYPE_FINGERPRINT, // Service provider 
     WINBIO_POOL_SYSTEM,   // Pool type 
     WINBIO_FLAG_RAW,   // Access: Capture raw data 
     NULL,      // Array of biometric unit IDs 
     0,       // Count of biometric unit IDs 
     WINBIO_DB_DEFAULT,   // Default database 
     &sessionHandle    // [out] Session handle 
     ); 
if (FAILED(hr)) 
{ 
    wprintf_s(L"\n WinBioOpenSession failed. hr = 0x%x\n", hr); 
    goto e_Exit; 
} 

// Capture a biometric sample. 
wprintf_s(L"\n Calling WinBioCaptureSample - Swipe sensor...\n"); 
hr = WinBioCaptureSample(
     sessionHandle, 
     WINBIO_NO_PURPOSE_AVAILABLE, 
     WINBIO_DATA_FLAG_RAW, 
     &unitId, 
     &sample, 
     &sampleSize, 
     &rejectDetail 
     ); 
if (FAILED(hr)) 
{ 
    if (hr == WINBIO_E_BAD_CAPTURE) 
    { 
     wprintf_s(L"\n Bad capture; reason: %d\n", rejectDetail); 
    } 
    else 
    { 
     wprintf_s(L"\n WinBioCaptureSample failed. hr = 0x%x\n", hr); 
    } 
    goto e_Exit; 
} 

wprintf_s(L"\n Swipe processed - Unit ID: %d\n", unitId); 
wprintf_s(L"\n Captured %d bytes.\n", sampleSize); 
e_Exit: 
if (sample != NULL) 
{ 
    WinBioFree(sample); 
    sample = NULL; 
} 

if (sessionHandle != NULL) 
{ 
    WinBioCloseSession(sessionHandle); 
    sessionHandle = NULL; 
} 

wprintf_s(L"\n Press any key to exit..."); 
_getch(); 

return hr; 
} 

回答

2

使用DUMPBIN和LIB命令在VS 2008中

當然,你使用的是舊版本的Windows SDK的。 VS2008附帶6.0版本。然而,這個api只適用於2009年發佈的Windows 7。您需要更新SDK,我推薦使用version 7.1

+0

更新到7.1搗蛋的伎倆,但現在我收到錯誤,如WINBIO_SESSION_HANDLE sessionHandle沒有在這個範圍內宣佈和許多其他類似的,爲什麼? –

+1

http://msdn.microsoft.com/en-us/library/6sehtctf.aspx –

+0

Tnx,讓它工作! –

2

嘗試下載Windows套件(8.0或8.1) - 至少這是我的Winbio.h。它隨Visual Studio 2012一起安裝,但可以單獨下載。

+0

Winbio.h和Winbio.lib可用於7.0及更高版本。 –

相關問題