// 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;
}