home *** CD-ROM | disk | FTP | other *** search
- // multivw.cpp : implementation file
- //
-
- #include "stdafx.h"
- #include "multi.h"
- #include "multivw.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CMultiView
-
- IMPLEMENT_DYNCREATE(CMultiView, CFormView)
-
- CMultiView::CMultiView()
- : CFormView(CMultiView::IDD)
- {
- //{{AFX_DATA_INIT(CMultiView)
- m_cd = NULL;
- m_mid = NULL;
- m_pc = NULL;
- m_wav = NULL;
- m_avi = NULL;
- m_Silent = FALSE;
- m_PcSong = -1;
- m_AutoRepeat = FALSE;
- //}}AFX_DATA_INIT
- }
-
- CMultiView::~CMultiView()
- {
- }
-
- void CMultiView::DoDataExchange(CDataExchange* pDX)
- {
- CFormView::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CMultiView)
- DDX_VBControl(pDX, IDC_TEGOMM_CD, m_cd);
- DDX_VBControl(pDX, IDC_TEGOMM_MID, m_mid);
- DDX_VBControl(pDX, IDC_TEGOMM_PC, m_pc);
- DDX_VBControl(pDX, IDC_TEGOMM_WAV, m_wav);
- DDX_VBControl(pDX, IDC_TEGOMM_AVI, m_avi);
- DDX_Check(pDX, IDC_SILENT, m_Silent);
- DDX_Radio(pDX, IDC_RADIO_PC1, m_PcSong);
- DDX_Check(pDX, IDC_AUTO_REPEAT, m_AutoRepeat);
- //}}AFX_DATA_MAP
- }
-
-
- BEGIN_MESSAGE_MAP(CMultiView, CFormView)
- //{{AFX_MSG_MAP(CMultiView)
- ON_BN_CLICKED(IDC_RADIO_PC1, OnRadioPc1)
- ON_BN_CLICKED(IDC_RADIO_PC2, OnRadioPc2)
- ON_BN_CLICKED(IDC_RADIO_PC3, OnRadioPc3)
- ON_BN_CLICKED(IDC_BUTTON_LOAD, OnButtonLoad)
- ON_WM_PAINT()
- ON_VBXEVENT(VBN_DONE, IDC_TEGOMM_AVI, OnDoneTegommAvi)
- ON_VBXEVENT(VBN_DONE, IDC_TEGOMM_MID, OnDoneTegommMid)
- ON_VBXEVENT(VBN_DONE, IDC_TEGOMM_PC, OnDoneTegommPc)
- ON_VBXEVENT(VBN_DONE, IDC_TEGOMM_WAV, OnDoneTegommWav)
- ON_BN_CLICKED(IDC_SILENT, OnSilent)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
-
- /////////////////////////////////////////////////////////////////////////////
- // CMultiView message handlers
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- void CMultiView::OnInitialUpdate()
- {
-
- // Call the base class function.
- CFormView::OnInitialUpdate();
-
- // Initialize the m_PcSong variable.
- // (the song number for the m_pc multimedia control).
- m_PcSong=0;
- UpdateData(FALSE);
-
- // Open the WAV file for PC Speaker.
- m_pc->SetStrProperty("DeviceType","PCSpeaker");
- m_pc->SetStrProperty("FileName",
- "\\VCPROG\\WAV\\BOURB1M1.WAV" );
- m_pc->SetStrProperty("Command", "Open");
-
- // Was the WAV file opened successfully?
- if ( m_pc->GetNumProperty("Error") != 0 )
- MessageBox("Cannot open the file "+m_pc->GetStrProperty("FileName"), "Error", MB_ICONSTOP);
-
- // Open the MOVIE.AVI file.
- m_avi->SetStrProperty("DeviceType","AVIVideo");
- m_avi->SetStrProperty("FileName",
- "\\VCPROG\\AVI\\MOVIE.AVI" );
- m_avi->SetStrProperty("Command", "Open");
-
- // Was the AVI file opened successfully?
- if ( m_avi->GetNumProperty("Error") != 0 )
- MessageBox("Cannot open the file "+m_avi->GetStrProperty("FileName"), "Error", MB_ICONSTOP);
-
- // Movie should play inside application's window.
- m_avi->SetNumProperty("hWndDisplay",(int)m_hWnd);
-
- // Open the WAV file (for the sound card).
- m_wav->SetStrProperty("DeviceType","WaveAudio");
- m_wav->SetStrProperty("FileName",
- "\\VCPROG\\WAV\\HOLID1M1.WAV" );
- m_wav->SetStrProperty("Command", "Open");
-
- // Was the WAV file opened successfully?
- if ( m_wav->GetNumProperty("Error") != 0 )
- MessageBox("Cannot open the file "+m_wav->GetStrProperty("FileName"), "Error", MB_ICONSTOP);
-
- // Open the MID file.
- m_mid->SetStrProperty("DeviceType","Sequencer");
- m_mid->SetStrProperty("FileName",
- "\\VCPROG\\MIDI\\PICKIN6.MID" );
- m_mid->SetStrProperty("Command", "Open");
-
- // Was the MID file opened successfully?
- if ( m_mid->GetNumProperty("Error") != 0 )
- MessageBox("Cannot open the file "+m_mid->GetStrProperty("FileName"), "Error", MB_ICONSTOP);
-
- // Try to open the m_cd multimedia control.
- // Note: The user can also open the m_cd multimedia
- // control by clicking the IDC_BUTTON_LOAD button.
- m_cd->SetStrProperty("DeviceType","CDAudio");
- m_cd->SetStrProperty("Command", "Open");
-
- }
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
- void CMultiView::OnRadioPc1()
- {
- // TODO: Add your control notification handler code here
-
- ///////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Open WAV file number 1.
- m_pc->SetStrProperty("FileName",
- "\\VCPROG\\WAV\\BOURB1M1.WAV" );
- m_pc->SetStrProperty("Command", "Open");
-
- // Was the WAV file opened successfully?
- if ( m_pc->GetNumProperty("Error") != 0 )
- MessageBox("Cannot open the file "+m_pc->GetStrProperty("FileName"), "Error", MB_ICONSTOP);
-
- // Update the variable of the radio button.
- UpdateData(TRUE);
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
-
- }
-
- void CMultiView::OnRadioPc2()
- {
- // TODO: Add your control notification handler code here
-
- ///////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Open WAV file number 2.
- m_pc->SetStrProperty("FileName",
- "\\VCPROG\\WAV\\STROL1M1.WAV" );
- m_pc->SetStrProperty("Command", "Open");
-
- // Was the WAV file opened successfully?
- if ( m_pc->GetNumProperty("Error") != 0 )
- MessageBox("Cannot open the file "+m_pc->GetStrProperty("FileName"), "Error", MB_ICONSTOP);
-
- // Update the variable of the radio button.
- UpdateData(TRUE);
-
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-
- void CMultiView::OnRadioPc3()
- {
- // TODO: Add your control notification handler code here
-
- ///////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Open WAV file number 3.
- m_pc->SetStrProperty("FileName",
- "\\VCPROG\\WAV\\8KENNED3.WAV" );
- m_pc->SetStrProperty("Command", "Open");
-
- // Was the WAV file opened successfully?
- if ( m_pc->GetNumProperty("Error") != 0 )
- MessageBox("Cannot open the file "+m_pc->GetStrProperty("FileName"), "Error", MB_ICONSTOP);
-
- // Update the variable of the radio button.
- UpdateData(TRUE);
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
- }
-
- void CMultiView::OnButtonLoad()
- {
- // TODO: Add your control notification handler code here
-
- ///////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Issue an Open command to the CD device.
- m_cd->SetStrProperty("Command", "Open");
-
-
- // Was the CD Audio device opened successfully?
- if ( m_cd->GetNumProperty("Error") != 0 )
- MessageBox("Cannot open the CD Audio device.", "Error", MB_ICONSTOP );
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-
- void CMultiView::OnPaint()
- {
- CPaintDC dc(this); // device context for painting
-
- // TODO: Add your message handler code here
-
- ///////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Repaint the current frame.
- m_avi->SetStrProperty( "Command", "Repaint" );
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
-
-
- // Do not call CFormView::OnPaint() for painting messages
- }
-
- void CMultiView::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 CMultiView::OnDoneTegommMid(UINT, int, CWnd*, LPVOID)
- {
- // TODO: Add your VBX event notification handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- if ( m_mid->GetNumProperty("Position") == m_mid->GetNumProperty("Length") )
- m_mid->SetStrProperty("Command","Prev");
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-
- void CMultiView::OnDoneTegommPc(UINT, int, CWnd*, LPVOID)
- {
- // TODO: Add your VBX event notification handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- if ( m_pc->GetNumProperty("Position") == m_pc->GetNumProperty("Length") )
- m_pc->SetStrProperty("Command","Prev");
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-
- void CMultiView::OnDoneTegommWav(UINT, int, CWnd*, LPVOID)
- {
- // TODO: Add your VBX event notification handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- if ( m_wav->GetNumProperty("Position") == m_wav->GetNumProperty("Length") )
- m_wav->SetStrProperty("Command","Prev");
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-
- void CMultiView::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
- ////////////////////
-
- }
-