| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 | 
							
- #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;
 
- 	
 
- 	if (!AfxWinInit(::GetModuleHandle(NULL), NULL, ::GetCommandLine(), 0))
 
- 	{
 
- 		
 
- 		_tprintf(_T("错误: MFC 初始化失败\n"));
 
- 		nRetCode = 1;
 
- 	}
 
- 	else
 
- 	{
 
- 		
 
- 		CMemoryServer ms;
 
- 		if ( ms.InitMemery() == FALSE )
 
- 		{
 
- 			printf("初始化共享内存失败\n");
 
- 		}
 
- 		if (ms.StartApp("VideoCapture.exe"))
 
- 		{
 
- 			printf("打开程序成功\n");
 
- 			Sleep(2000);
 
- 			ms.ConnectDevice();
 
- 			
 
- 			
 
- 			
 
- 			
 
- 			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);
 
- 			}
 
- 			
 
- 			
 
- 			
 
- 			
 
- 			
 
- 			
 
- 			
 
- 			
 
- 			
 
- 			
 
- 			Sleep(1000);
 
- 			
 
- 			ms.DisconnectDevice();
 
- 			printf("结束\n");
 
- 			getchar();
 
- 		}
 
- 	}
 
- 	return nRetCode;
 
- }
 
 
  |