home *** CD-ROM | disk | FTP | other *** search
- // aviview.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "avi.h"
- #include "aviview.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CAviView
-
- IMPLEMENT_DYNCREATE(CAviView, CFormView)
-
- CAviView::CAviView()
- : CFormView(CAviView::IDD)
- {
- //{{AFX_DATA_INIT(CAviView)
- m_avi = NULL;
- m_AutoRepeat = FALSE;
- m_Silent = FALSE;
- //}}AFX_DATA_INIT
- }
-
- CAviView::~CAviView()
- {
- }
-
- void CAviView::DoDataExchange(CDataExchange* pDX)
- {
- CFormView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CAviView)
- DDX_VBControl(pDX, IDC_TEGOMM_AVI, m_avi);
- DDX_Check(pDX, IDC_AUTO_REPEAT, m_AutoRepeat);
- DDX_Check(pDX, IDC_SILENT, m_Silent);
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(CAviView, CFormView)
- //{{AFX_MSG_MAP(CAviView)
- ON_VBXEVENT(VBN_DONE, IDC_TEGOMM_AVI, OnDoneTegommAvi)
- ON_BN_CLICKED(IDC_SILENT, OnSilent)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CAviView message handlers
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- void CAviView::OnInitialUpdate()
- {
-
- // Call the base class function.
- CFormView::OnInitialUpdate();
-
- // Open the MOVIE.AVI file.
- m_avi->SetStrProperty("DeviceType","AVIVideo");
- m_avi->SetStrProperty("FileName",
- "\\VCPROG\\AVI\\MOVIE.AVI" );
- m_avi->SetStrProperty("Command", "Open");
-
- // Movie should play inside application's window.
- m_avi->SetNumProperty("hWndDisplay",(int)m_hWnd);
-
- }
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- void CAviView::OnDoneTegommAvi(UINT, int, CWnd*, LPVOID)
- {
- // TODO: Add your VBX event notification handler code here
-
- ///////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Update the variable m_AutoRepeat.
- UpdateData(TRUE);
-
- // Get current position.
- long position = m_avi->GetNumProperty("Position");
-
- // Get total length.
- long length = m_avi->GetNumProperty("Length");
-
- // If current position is end position, rewind the tape.
- if (position == length)
- {
- m_avi->SetStrProperty("Command", "Prev");
-
- // If Auto Repeat check box is checked, play again.
- if (m_AutoRepeat == TRUE )
- {
- m_avi->SetStrProperty("Command", "Play");
- }
-
- }
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-
- void CAviView::OnSilent()
- {
- // TODO: Add your control notification handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Update the m_Silent variable.
- UpdateData(TRUE);
-
- // Set the Silent property.
- m_avi->SetNumProperty("Silent", m_Silent);
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-