/**********************************************************************/
/*                  BDEFRANG.cpp by Bob Bourbonnais                   */
/*              released to the public domain 1/26/92                 */
/*           This program shows how to trap for ranges of             */
/*             Button messages in the DefChild Process.               */
/**********************************************************************/
#include <owl.h>
#include <dialog.h>
#include "bwcc.h"                        // needed for BWCC

class TMyDialog : public TDialog
  {
  public:
    TMyDialog(LPSTR lpDialogName)          // constructor calls
      : TDialog(NULL,lpDialogName)         // base class constructor
      {
      BWCCGetVersion();    // activate Borland Windows Custom Controls
      }
    virtual void DefChildProc(RTMessage Msg);
  };

void TMyDialog::DefChildProc(RTMessage Msg)
  {
  if (Msg.WParam <= 4)             // First row unprocessed messages 3 - 4
    {
    MessageBeep(0);
    BWCCMessageBox(HWindow,"Feature Not Implemented","First Row",MB_OK);
    }
  else if (Msg.WParam <= 8)       // Second row unprocessed messages 5 - 8
    {
    MessageBeep(0);
    BWCCMessageBox(HWindow,"Feature Not Implemented","Second Row",MB_OK);
    MessageBeep(0);
    }
  else                            // Any other unprocessed child messages
    {
    MessageBeep(0);
    BWCCMessageBox(HWindow,"Feature Not Implemented","Out of Range",MB_OK);
    }

  TDialog::DefChildProc(Msg);
  }

class TDialog1App : public TApplication  // Application Class to contain
  {                                      // the application
  public:
    TDialog1App(LPSTR lpName, HANDLE hInstance,  // constructor calls the
		HANDLE hPrevInstance,            // base class constructor
		LPSTR lpCmdLine, int nCmdShow)
		:TApplication(lpName, hInstance,
			      hPrevInstance,
			      lpCmdLine, nCmdShow) {};

    virtual void InitMainWindow(); // overrides base class InitMainWindow
  };

void TDialog1App::InitMainWindow() // to initialize a dialog box
  {                                // as the main window
  MainWindow = new TMyDialog("MAINWINDOWDIALOG");
  }

int PASCAL WinMain(HANDLE hInstance,              // main entry point from
		   HANDLE hPrevInstance,          // windows to this program
		   LPSTR lpCmdLine , int nCmdShow)
  {
  TDialog1App Dialog1("Dialog Tester",hInstance,  // create instance of
		       hPrevInstance,             // the dialog application
		       lpCmdLine,nCmdShow);
  Dialog1.Run();                                  // run it
  return (Dialog1.Status);                        // exit
  }
/**********************************************************************/
