home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / windows / c / wvplr1 / wpdemo.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-25  |  3.8 KB  |  198 lines

  1. /*  Project wpdemo
  2.     Lighthouse Engineering
  3.     Copyright   1994 by Lighthouse Engineering.  All Rights Reserved.
  4.  
  5.     SUBSYSTEM:    wpdemo.exe Application
  6.     FILE:         wpdemo.cpp
  7.     AUTHOR:       K. Scott Piel
  8.  
  9.  
  10.     OVERVIEW
  11.     ========
  12.     Source file for implementation of wpDemoApp (TApplication).
  13. */
  14.  
  15.  
  16. #include <owl\owlpch.h>
  17. #include <owl\opensave.h>
  18. #pragma hdrstop
  19.  
  20. #include "wpdemo.h"
  21. #include "aboutdlg.h"                        // Definition of about dialog.
  22. #include "wavplayr.hpp"
  23. #include "wavexmpll.h"
  24.  
  25. char HelpFileName[] = "wavplayr.hlp";
  26.  
  27. //{{wpDemoApp Implementation}}
  28.  
  29.  
  30. DEFINE_RESPONSE_TABLE1(wpDemoApp, TApplication)
  31. //{{wpDemoAppRSP_TBL_BEGIN}}
  32.     EV_COMMAND(CM_SAYNUM, SayNumbers),
  33.     EV_COMMAND(CM_PLAYFILE, PlayFile),
  34.     EV_COMMAND(CM_HELPABOUT, CmHelpAbout),
  35.     EV_COMMAND(CM_HELPINFO, HelpInfo),
  36.     EV_COMMAND(CM_HELPREGISTER, RegisterInfo),
  37.     EV_COMMAND(CM_HELPLICENSING, HelpLicensing),
  38.     EV_COMMAND(CM_HELPWAVEPLAYER_REFERENCE, HelpReference),
  39. //{{wpDemoAppRSP_TBL_END}}
  40. END_RESPONSE_TABLE;
  41.  
  42.  
  43. class SDIDecFrame : public TDecoratedFrame {
  44. public:
  45.     SDIDecFrame (TWindow *parent, const char far *title, TWindow *clientWnd, BOOL trackMenuSelection = FALSE, TModule *module = 0) :
  46.             TDecoratedFrame(parent, title, clientWnd, trackMenuSelection, module)
  47.       {  }
  48.     ~SDIDecFrame ()
  49.       {  }
  50. };
  51.  
  52.  
  53. wpDemoApp::wpDemoApp () : TApplication("WavePlayer Demonstration")
  54. {
  55.     HelpState   = FALSE;
  56.     ContextHelp = FALSE;
  57.     HelpCursor  = 0;
  58.  
  59.     FileData.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT;
  60.     FileData.SetFilter("Wave Files (*.wav)|*.wav|");
  61.  
  62.     // INSERT>> Your constructor code here.
  63.  
  64. }
  65.  
  66.  
  67. wpDemoApp::~wpDemoApp ()
  68. {
  69.     // INSERT>> Your destructor code here.
  70.  
  71. }
  72.  
  73.  
  74. void wpDemoApp::InitMainWindow ()
  75. {
  76.     Client = new TWindow(0, "");
  77.     SDIDecFrame *frame = new SDIDecFrame(0, GetName(), Client, FALSE);
  78.  
  79.     nCmdShow = nCmdShow != SW_SHOWMINIMIZED ? SW_SHOWNORMAL : nCmdShow;
  80.  
  81.     frame->SetIcon(this, IDI_SDIAPPLICATION);
  82.  
  83.     frame->AssignMenu(SDI_MENU);
  84.  
  85.     MainWindow = frame;
  86.  
  87. }
  88.  
  89.  
  90. void wpDemoApp::SayNumbers ()
  91. {
  92.     WaveExample(MainWindow).Execute();
  93. }
  94.  
  95.  
  96. void wpDemoApp::PlayFile ()
  97. {
  98.     TFileOpenDialog    *opendlg;
  99.     WavePlayer        Player( _hInstance, this );
  100.  
  101.     // get a file to be opened
  102.  
  103.     opendlg = new TFileOpenDialog( MainWindow, FileData, 0, "Open Wave File" );
  104.  
  105.     if( !opendlg ) return;
  106.  
  107.     if( opendlg->Execute() != IDOK )
  108.     {
  109.         delete opendlg;
  110.         return;
  111.     }
  112.  
  113.     Player.Execute( FileData.FileName );
  114.  
  115.     delete opendlg;
  116. }
  117.  
  118.  
  119. // Menu Help About wpdemo.exe command
  120. void wpDemoApp::CmHelpAbout ()
  121. {
  122.     AboutDlg(MainWindow).Execute();
  123. }
  124.  
  125.  
  126. int OwlMain (int , char* [])
  127. {
  128.     wpDemoApp     App;
  129.     int             result;
  130.  
  131.     result = App.Run();
  132.  
  133.     return result;
  134. }
  135.  
  136. void wpDemoApp::HelpInfo ()
  137. {
  138.     // INSERT>> Your code here.
  139.  
  140.     HelpState = MainWindow->WinHelp(HelpFileName, HELP_CONTENTS, 0L);
  141. }
  142.  
  143.  
  144. void wpDemoApp::RegisterInfo ()
  145. {
  146.     // INSERT>> Your code here.
  147.  
  148.     HelpState = MainWindow->WinHelp(HelpFileName, HELP_CONTEXT, Registering_WavePlayer );
  149. }
  150.  
  151.  
  152. void wpDemoApp::HelpLicensing ()
  153. {
  154.     // INSERT>> Your code here.
  155.  
  156.     HelpState = MainWindow->WinHelp(HelpFileName, HELP_CONTEXT, Licensing_Agreement );
  157. }
  158.  
  159.  
  160. void wpDemoApp::HelpReference ()
  161. {
  162.     // INSERT>> Your code here.
  163.  
  164.     HelpState = MainWindow->WinHelp(HelpFileName, HELP_CONTEXT, WavePlayer_Class_Reference );
  165. }
  166.  
  167.  
  168. int wpDemoApp::TermInstance (int status)
  169. {
  170.     int result;
  171.  
  172.     WavePlayer        Player( _hInstance, this );
  173.  
  174.     Player.Execute( IDW_REGISTER );
  175.  
  176.     result = TApplication::TermInstance(status);
  177.  
  178.     // INSERT>> Your code here.
  179.  
  180.     return result;
  181. }
  182.  
  183.  
  184. BOOL wpDemoApp::CanClose ()
  185. {
  186.     BOOL result;
  187.  
  188.     result = TApplication::CanClose();
  189.  
  190.     // INSERT>> Your code here.
  191.  
  192.     if( HelpState )
  193.         MainWindow->WinHelp( HelpFileName, HELP_QUIT, 0L );
  194.  
  195.     return result;
  196. }
  197.  
  198.