The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

VideoDemo.cpp

Go to the documentation of this file.
00001 // VideoDemo.cpp : Defines the class behaviors for the application.
00002 //
00003 
00004 #include "stdafx.h"
00005 #include "VideoDemo.h"
00006 #include "Projectsbox.h"
00007 #include "SaveVideo.h"
00008 
00009 #include "MainFrm.h"
00010 
00011 #ifdef _DEBUG
00012 #define new DEBUG_NEW
00013 #undef THIS_FILE
00014 static char THIS_FILE[] = __FILE__;
00015 #endif
00016 
00018 // CVideoDemoApp
00019 
00020 BEGIN_MESSAGE_MAP(CVideoDemoApp, CWinApp)
00021         //{{AFX_MSG_MAP(CVideoDemoApp)
00022         ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
00023         ON_COMMAND(ID_APP_PROJECT, OnAppProject)
00024         ON_COMMAND(ID_FILE_SAVEVIDEO, OnFileSavevideo)
00025         //}}AFX_MSG_MAP
00026 END_MESSAGE_MAP()
00027 
00029 // CVideoDemoApp construction
00030 
00031 CVideoDemoApp::CVideoDemoApp()
00032 {
00033         // TODO: add construction code here,
00034         // Place all significant initialization in InitInstance
00035 }
00036 
00038 // The one and only CVideoDemoApp object
00039 
00040 CVideoDemoApp theApp;
00041 
00043 // CVideoDemoApp initialization
00044 
00045 BOOL CVideoDemoApp::InitInstance()
00046 {
00047         AfxEnableControlContainer();
00048 
00049         // Standard initialization
00050         // If you are not using these features and wish to reduce the size
00051         //  of your final executable, you should remove from the following
00052         //  the specific initialization routines you do not need.
00053 
00054 #ifdef _AFXDLL
00055         Enable3dControls();                     // Call this when using MFC in a shared DLL
00056 #else
00057         Enable3dControlsStatic();       // Call this when linking to MFC statically
00058 #endif
00059 
00060         // Change the registry key under which our settings are stored.
00061         // TODO: You should modify this string to be something appropriate
00062         // such as the name of your company or organization.
00063         SetRegistryKey(_T("Local AppWizard-Generated Applications"));
00064 
00065 
00066         // To create the main window, this code creates a new frame window
00067         // object and then sets it as the application's main window object.
00068 
00069         CMainFrame* pFrame = new CMainFrame;
00070         m_pMainWnd = pFrame;
00071         pFrame->setDirectShow(&m_directShow);
00072 
00073         // create and load the frame with its resources
00074 
00075         pFrame->LoadFrame(IDR_MAINFRAME,
00076                 WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL,
00077                 NULL);
00078 
00079         Projectsbox project;
00080         project.setDirectShow(&m_directShow);
00081         project.DoModal();
00082 
00083         int totalDevicesFound;
00084          if(m_directShow.GetVideoDevices() == 0)
00085                 {
00086                         MessageBox(NULL, (LPCTSTR)"Video device not found", NULL, MB_OK); 
00087                         exit (-1);
00088                 }
00089          m_directShow.SetVideoDevices(0);
00090         DeviceList deviceList;
00091         deviceList.setDirectShow(&m_directShow, totalDevicesFound, dl_capture);
00092         deviceList.DoModal();
00093         m_directShow.RunDirectShow(pFrame->m_hWnd);
00094         //SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL-1);
00095 
00096         
00097         // The one and only window has been initialized, so show and update it.
00098         pFrame->ShowWindow(SW_SHOW);
00099         pFrame->UpdateWindow();
00100 
00101         return TRUE;
00102 }
00103 
00105 // CVideoDemoApp message handlers
00106 
00107 
00108 
00109 
00110 
00112 // CAboutDlg dialog used for App About
00113 
00114 class CAboutDlg : public CDialog
00115 {
00116 public:
00117         CAboutDlg();
00118 
00119 // Dialog Data
00120         //{{AFX_DATA(CAboutDlg)
00121         enum { IDD = IDD_ABOUTBOX };
00122         //}}AFX_DATA
00123 
00124         // ClassWizard generated virtual function overrides
00125         //{{AFX_VIRTUAL(CAboutDlg)
00126         protected:
00127         virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
00128         //}}AFX_VIRTUAL
00129 
00130 // Implementation
00131 protected:
00132         //{{AFX_MSG(CAboutDlg)
00133                 // No message handlers
00134         //}}AFX_MSG
00135         DECLARE_MESSAGE_MAP()
00136 };
00137 
00138 CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
00139 {
00140         //{{AFX_DATA_INIT(CAboutDlg)
00141         //}}AFX_DATA_INIT
00142 }
00143 
00144 void CAboutDlg::DoDataExchange(CDataExchange* pDX)
00145 {
00146         CDialog::DoDataExchange(pDX);
00147         //{{AFX_DATA_MAP(CAboutDlg)
00148         //}}AFX_DATA_MAP
00149 }
00150 
00151 BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
00152         //{{AFX_MSG_MAP(CAboutDlg)
00153                 // No message handlers
00154         //}}AFX_MSG_MAP
00155 END_MESSAGE_MAP()
00156 
00157 // App command to run the dialog
00158 void CVideoDemoApp::OnAppAbout()
00159 {
00160         CAboutDlg aboutDlg;
00161         aboutDlg.DoModal();
00162 }
00163 
00165 // CVideoDemoApp message handlers
00166 
00167 
00168 
00169 void CVideoDemoApp::OnAppProject() 
00170 {
00171         Projectsbox project;
00172         project.setDirectShow(&m_directShow);
00173         project.DoModal();
00174         
00175 }
00176 
00177 void CVideoDemoApp::OnFileSavevideo() 
00178 {
00179         SaveVideo saveVideo;
00180         saveVideo.setDirectShow(&m_directShow);
00181         saveVideo.DoModal();
00182         
00183 }
00184 

Generated on Mon Nov 8 17:07:52 2004 for MPT by  doxygen 1.3.9.1