// test.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include "test.h" #include "MemoryServer.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // 唯一的应用程序对象 CWinApp theApp; using namespace std; int _tmain(int argc, TCHAR* argv[], TCHAR* envp[]) { int nRetCode = 0; // 初始化 MFC 并在失败时显示错误 if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0)) { // TODO: 更改错误代码以符合您的需要 _tprintf(_T("错误: MFC 初始化失败\n")); nRetCode = 1; } else { // TODO: 在此处为应用程序的行为编写代码。 CMemoryServer ms; if ( ms.InitMemery() == FALSE ) { printf("初始化共享内存失败\n"); } if (ms.StartApp("VideoCapture.exe")) { printf("打开程序成功\n"); Sleep(2000); ms.ConnectDevice(); //printf("连接设备\n"); //Sleep(12000); //printf("CaptureSingleImage\n"); // 持续方式:以张数为单位; TCHAR szName[MAX_PATH] = { 0 }; for (int i = 0; i < 10000; i++) { _stprintf(szName, _T("D:\\test\\%02d.jpg"), i); ms.CaptureSingleImage(szName, 2, TRUE); } //printf("%ld\n", GetTickCount() - dwTickCount); //Sleep(120); //printf("CaptureImageByCount\n"); // 持续方式:以秒为单位; //cd750.CaptureImageByCount(1/*每秒多少张*/, _T(".\\ByCount\\")); //Sleep(12000); //printf("CaptureImageByTime\n"); // 持续方式:以秒为单位; //ms.CaptureImageByTime( 12000/*持续时间,秒*/, 20/*每秒多少张*/, _T("F:\\bin\\VideoCapture\\aaaa\\"), _T("dfdf")); //printf("CaptureAudio\n"); Sleep(1000); //cd750.SynCaptureAudio(_T(".\\Audio\\")); ms.DisconnectDevice(); printf("结束\n"); getchar(); } } return nRetCode; }