home *** CD-ROM | disk | FTP | other *** search
/ Master Visual C++ 1.5 / MASTERVC15.ISO / vcprog / original / ch32 / my3d / my3dview.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-08  |  2.3 KB  |  105 lines

  1. // my3dview.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "my3d.h"
  6. #include "my3dview.h"
  7.  
  8. #ifdef _DEBUG
  9. #undef THIS_FILE
  10. static char BASED_CODE THIS_FILE[] = __FILE__;
  11. #endif
  12.  
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CMy3dView
  15.  
  16. IMPLEMENT_DYNCREATE(CMy3dView, CFormView)
  17.  
  18. CMy3dView::CMy3dView()
  19.     : CFormView(CMy3dView::IDD)
  20. {
  21.     //{{AFX_DATA_INIT(CMy3dView)
  22.     // NOTE: the ClassWizard will add member initialization here
  23.     //}}AFX_DATA_INIT
  24.  
  25.     //////////////////////
  26.     // MY CODE STARTS HERE
  27.     //////////////////////
  28.  
  29.     char FileToOpen[255];
  30.  
  31.  
  32.     // Open the 8Reagan WAV session
  33.     strcpy ( FileToOpen, "\\vcProg\\WAV\\8Reagan.WAV" );
  34.     m_ReaganSession = sp_OpenSession ( FileToOpen );
  35.  
  36.  
  37.     // If WAV session cannot be opened, display message box.
  38.     if ( m_ReaganSession < 0 )
  39.        {
  40.         CString Message, Caption;
  41.         Message = "Can't open the file: ";
  42.         Message = Message + FileToOpen;
  43.         Caption = "Error";
  44.         MessageBox ( Message, Caption );
  45.        }
  46.  
  47.    ////////////////////
  48.    // MY CODE ENDS HERE
  49.    ////////////////////
  50.  
  51. }
  52.  
  53. CMy3dView::~CMy3dView()
  54. {
  55.  
  56.      //////////////////////
  57.      // MY CODE STARTS HERE
  58.      //////////////////////
  59.  
  60.      sp_CloseSession ( m_ReaganSession );
  61.  
  62.      ////////////////////,
  63.      // MY CODE ENDS HERE
  64.      ////////////////////
  65.  
  66. }
  67.  
  68. void CMy3dView::DoDataExchange(CDataExchange* pDX)
  69. {
  70.     CFormView::DoDataExchange(pDX);
  71.     //{{AFX_DATA_MAP(CMy3dView)
  72.         // NOTE: the ClassWizard will add DDX and DDV calls here
  73.     //}}AFX_DATA_MAP
  74. }
  75.  
  76.  
  77. BEGIN_MESSAGE_MAP(CMy3dView, CFormView)
  78.     //{{AFX_MSG_MAP(CMy3dView)
  79.     ON_VBXEVENT(VBN_CLICK, IDC_COMMAND3D1, OnClickCommand3d1)
  80.     //}}AFX_MSG_MAP
  81. END_MESSAGE_MAP()
  82.  
  83.  
  84. /////////////////////////////////////////////////////////////////////////////
  85. // CMy3dView message handlers
  86.  
  87.  
  88. void CMy3dView::OnClickCommand3d1(UINT, int, CWnd*, LPVOID)
  89. {
  90.     // TODO: Add your VBX event notification handler code here
  91.  
  92.      //////////////////////
  93.      // MY CODE STARTS HERE
  94.      //////////////////////
  95.  
  96.     // Play the Reagan speech
  97.     sp_PlaySnd ( m_ReaganSession,
  98.                  SP_START_OF_FILE,
  99.                  SP_END_OF_FILE);
  100.  
  101.      ////////////////////
  102.      // MY CODE ENDS HERE
  103.      ////////////////////
  104. }
  105.