test.cpp 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. // test.cpp : 定义控制台应用程序的入口点。
  2. //
  3. #include "stdafx.h"
  4. #include "test.h"
  5. #include "MemoryServer.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #endif
  9. // 唯一的应用程序对象
  10. CWinApp theApp;
  11. using namespace std;
  12. int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
  13. {
  14. int nRetCode = 0;
  15. // 初始化 MFC 并在失败时显示错误
  16. if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
  17. {
  18. // TODO: 更改错误代码以符合您的需要
  19. _tprintf(_T("错误: MFC 初始化失败\n"));
  20. nRetCode = 1;
  21. }
  22. else
  23. {
  24. // TODO: 在此处为应用程序的行为编写代码。
  25. CMemoryServer ms;
  26. if ( ms.InitMemery() == FALSE )
  27. {
  28. printf("初始化共享内存失败\n");
  29. }
  30. if (ms.StartApp("VideoCapture.exe"))
  31. {
  32. printf("打开程序成功\n");
  33. Sleep(2000);
  34. ms.ConnectDevice();
  35. //printf("连接设备\n");
  36. //Sleep(12000);
  37. //printf("CaptureSingleImage\n");
  38. // 持续方式:以张数为单位;
  39. TCHAR szName[MAX_PATH] = { 0 };
  40. for (int i = 0; i < 10000; i++)
  41. {
  42. _stprintf(szName, _T("D:\\test\\%02d.jpg"), i);
  43. ms.CaptureSingleImage(szName, 2, TRUE);
  44. }
  45. //printf("%ld\n", GetTickCount() - dwTickCount);
  46. //Sleep(120);
  47. //printf("CaptureImageByCount\n");
  48. // 持续方式:以秒为单位;
  49. //cd750.CaptureImageByCount(1/*每秒多少张*/, _T(".\\ByCount\\"));
  50. //Sleep(12000);
  51. //printf("CaptureImageByTime\n");
  52. // 持续方式:以秒为单位;
  53. //ms.CaptureImageByTime( 12000/*持续时间,秒*/, 20/*每秒多少张*/, _T("F:\\bin\\VideoCapture\\aaaa\\"), _T("dfdf"));
  54. //printf("CaptureAudio\n");
  55. Sleep(1000);
  56. //cd750.SynCaptureAudio(_T(".\\Audio\\"));
  57. ms.DisconnectDevice();
  58. printf("结束\n");
  59. getchar();
  60. }
  61. }
  62. return nRetCode;
  63. }