home *** CD-ROM | disk | FTP | other *** search
- // mytoovw.cpp : implementation of the CMytoolView class
- //
-
- #include "stdafx.h"
- #include "mytool.h"
-
- #include "mytoodoc.h"
- #include "mytoovw.h"
-
- #ifdef _DEBUG
- #undef THIS_FILE
- static char BASED_CODE THIS_FILE[] = __FILE__;
- #endif
-
- /////////////////////////////////////////////////////////////////////////////
- // CMytoolView
-
- IMPLEMENT_DYNCREATE(CMytoolView, CView)
-
- BEGIN_MESSAGE_MAP(CMytoolView, CView)
- //{{AFX_MSG_MAP(CMytoolView)
- ON_COMMAND(ID_TRYIT_MESSAGE, OnTryitMessage)
- ON_COMMAND(ID_TRYIT_MUSIC, OnTryitMusic)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
-
- /////////////////////////////////////////////////////////////////////////////
- // CMytoolView construction/destruction
-
- CMytoolView::CMytoolView()
- {
- // TODO: add construction code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- char FileToOpen[255];
-
-
- // Open the Kennedy WAV session
- strcpy ( FileToOpen, "\\vcProg\\WAV\\LastC1M0.WAV" );
- m_MusicSession = sp_OpenSession ( FileToOpen );
-
-
- // If WAV session can not be opened, display message box.
- if ( m_MusicSession < 0 )
- {
- CString Message, Caption;
- Message = "Can't open the file: ";
- Message = Message + FileToOpen;
- Caption = "Error";
- MessageBox ( Message, Caption );
- }
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-
- CMytoolView::~CMytoolView()
- {
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Close the WAV session
- sp_CloseSession ( m_MusicSession );
-
- ////////////////////,
- // MY CODE ENDS HERE
- ////////////////////
-
-
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CMytoolView drawing
-
- void CMytoolView::OnDraw(CDC* pDC)
- {
- CMytoolDoc* pDoc = GetDocument();
- ASSERT_VALID(pDoc);
-
- // TODO: add draw code for native data here
- }
-
- /////////////////////////////////////////////////////////////////////////////
- // CMytoolView diagnostics
-
- #ifdef _DEBUG
- void CMytoolView::AssertValid() const
- {
- CView::AssertValid();
- }
-
- void CMytoolView::Dump(CDumpContext& dc) const
- {
- CView::Dump(dc);
- }
-
- CMytoolDoc* CMytoolView::GetDocument() // non-debug version is inline
- {
- ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMytoolDoc)));
- return (CMytoolDoc*)m_pDocument;
- }
- #endif //_DEBUG
-
- /////////////////////////////////////////////////////////////////////////////
- // CMytoolView message handlers
-
- void CMytoolView::OnTryitMessage()
- {
- // TODO: Add your command handler code here
-
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- MessageBox ("Try It -> Message was selected");
-
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
-
- }
-
- void CMytoolView::OnTryitMusic()
- {
- // TODO: Add your command handler code here
-
- //////////////////////
- // MY CODE STARTS HERE
- //////////////////////
-
- // Play the music
- sp_PlaySnd( m_MusicSession,
- SP_START_OF_FILE,
- SP_END_OF_FILE );
-
-
-
- ////////////////////
- // MY CODE ENDS HERE
- ////////////////////
-
- }
-