fork download
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <iostream>
  4. #include <windows.h>
  5. #include <time.h>
  6. //#include <thread>
  7.  
  8. #include "ZKFPCap.h"
  9. #include "futil.h"
  10.  
  11.  
  12. static HMODULE ZKFPCapLib = NULL;
  13. static HANDLE ZKFPCapHandle = NULL;
  14. HWND hwnd;
  15.  
  16. static BYTE *g_FPBuffer ;//= NULL
  17. static int g_bIsTimeToDie = 0;
  18. static int g_FPBufferSize = 0;
  19. static int g_nWidth = 0;
  20. static int g_nHeight = 0;
  21.  
  22. using namespace std;
  23.  
  24.  
  25.  
  26. DWORD WINAPI GetImage(LPVOID pParam)
  27. {
  28.  
  29.  
  30. while(!g_bIsTimeToDie)
  31. {
  32. memset(g_FPBuffer, 0, g_FPBufferSize);
  33.  
  34. //sensorCapture(ZKFPCapHandle, g_FPBuffer, g_FPBufferSize);
  35.  
  36. //cout<<"capture size: " <<sensorCapture(ZKFPCapHandle, g_FPBuffer, g_FPBufferSize)<<endl;
  37.  
  38. if(sensorCapture(ZKFPCapHandle, g_FPBuffer, g_FPBufferSize) > 0)
  39. {
  40. system("pause");
  41. //SendMessage(hwnd, MESSAGE_FP_RECEIVED, 0, 0);
  42. }
  43. //g_bIsTimeToDie=1;
  44. //return 0;
  45. }
  46. return 0;
  47. }
  48.  
  49. int loadZKFPCapLib() //Load ZKFPCap.dll and Read sensor function
  50. {
  51. ZKFPCapLib = LoadLibrary("ZKFPCap.dll");
  52.  
  53. if(ZKFPCapLib)
  54. {
  55. sensorInit = (T_sensorInit)GetProcAddress(ZKFPCapLib, "sensorInit");
  56. sensorFree = (T_sensorFree)GetProcAddress(ZKFPCapLib, "sensorFree");
  57. sensorOpen = (T_sensorOpen)GetProcAddress(ZKFPCapLib, "sensorOpen");
  58. sensorClose = (T_sensorClose)GetProcAddress(ZKFPCapLib, "sensorClose");
  59. sensorGetCount = (T_sensorGetCount)GetProcAddress(ZKFPCapLib, "sensorGetCount");
  60. sensorGetVersion = (T_sensorGetVersion)GetProcAddress(ZKFPCapLib, "sensorGetVersion");
  61. sensorCapture = (T_sensorCapture)GetProcAddress(ZKFPCapLib, "sensorCapture");
  62. sensorGetParameter = (T_sensorGetParameter)GetProcAddress(ZKFPCapLib, "sensorGetParameter");
  63. sensorSetParameter = (T_sensorSetParameter)GetProcAddress(ZKFPCapLib, "sensorSetParameter");
  64. sensorGetParameterEx = (T_sensorGetParameterEx)GetProcAddress(ZKFPCapLib, "sensorGetParameterEx");
  65. sensorSetParameterEx = (T_sensorSetParameterEx)GetProcAddress(ZKFPCapLib, "sensorSetParameterEx");
  66.  
  67. if(NULL == sensorInit)
  68. {
  69. return 0;
  70. }
  71. return 1;
  72. }
  73.  
  74. return 0;
  75. }
  76.  
  77. int main()
  78. {
  79. char paramValue[64] = {0};
  80. int ret = 0;
  81.  
  82. loadZKFPCapLib();
  83.  
  84. cout << sensorInit() << endl;
  85.  
  86. ZKFPCapHandle = sensorOpen(0);
  87.  
  88. cout <<"sensor open (0:success) : " << ZKFPCapHandle << endl;
  89.  
  90.  
  91. memset(paramValue, 0, 64);
  92. ret = sizeof(paramValue);
  93. sensorGetParameterEx(ZKFPCapHandle, 1, paramValue, &ret);
  94. g_nWidth = *((int *)paramValue);
  95.  
  96. memset(paramValue, 0, 64);
  97. ret = sizeof(paramValue);
  98. sensorGetParameterEx(ZKFPCapHandle, 2, paramValue, &ret);
  99. g_nHeight = *((int *)paramValue);
  100.  
  101.  
  102. cout << "(width, height) : "<< "("<<g_nWidth<<", "<<g_nHeight<<")" << endl;
  103.  
  104. memset(paramValue, 0, 64);
  105. ret = sizeof(paramValue);
  106. cout<<"Get ParameterEX : "<<sensorGetParameterEx(ZKFPCapHandle, 106, paramValue, &ret)<<endl;
  107. g_FPBufferSize = *((int *)paramValue);
  108.  
  109. cout<<"buffer size : "<<g_FPBufferSize<<endl;
  110.  
  111. g_FPBuffer = (BYTE *)malloc(g_FPBufferSize*sizeof(BYTE));
  112.  
  113. cout<<"sensor counter : "<<sensorGetCount()<<endl;
  114.  
  115. memset(paramValue, 0, 64);
  116. sensorGetVersion(paramValue, sizeof(paramValue));
  117. cout<<"Version : "<<paramValue<<endl;
  118.  
  119.  
  120. memset(g_FPBuffer, 0, g_FPBufferSize);
  121.  
  122. g_bIsTimeToDie=0;
  123.  
  124. cout<<"handle : "<<ZKFPCapHandle<<endl;
  125.  
  126. cout<<"capture size: " <<sensorCapture(ZKFPCapHandle, g_FPBuffer, g_FPBufferSize)<<endl;
  127.  
  128. /*
  129.   while(1)
  130.   {
  131.   cout<<"capture size: " <<sensorCapture(ZKFPCapHandle, g_FPBuffer, g_FPBufferSize)<<endl;
  132.  
  133.   Sleep(2500);
  134.   }
  135. */
  136.  
  137.  
  138. //cout<<"capture size: " <<sensorCapture(ZKFPCapHandle, g_FPBuffer, g_FPBufferSize)<<endl;
  139.  
  140. //g_bIsTimeToDie=0;
  141.  
  142. //GetImage(NULL);
  143.  
  144. for(int i=0; i<g_FPBufferSize; i++)
  145. {
  146.  
  147.  
  148. //if(g_FPBuffer[i]!=0)
  149. {
  150. printf("%d\n",g_FPBuffer[i]);
  151. system("pause");
  152. }
  153.  
  154. }
  155. /**/
  156.  
  157.  
  158.  
  159. return 0;
  160. }
  161.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.c:3:20: fatal error: iostream: No such file or directory
compilation terminated.
stdout
Standard output is empty