home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 7.ddi / OWLDEMOS.ZIP / EWNDTEST.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  1.4 KB  |  61 lines

  1. // ObjectWindows - (C) Copyright 1992 by Borland International
  2.  
  3. #include <owl.h>
  4. #include <stdio.h>
  5. #include <editwnd.h>
  6. #include "ewndtest.h"
  7.  
  8. class TTestApp : public TApplication
  9. {
  10. public:
  11.   TTestApp(LPSTR AName, HINSTANCE hInstance, HINSTANCE hPrevInstance,
  12.     LPSTR lpCmdLine, int nCmdShow)
  13.     : TApplication(AName, hInstance, hPrevInstance, lpCmdLine, nCmdShow) {};
  14.   virtual void InitMainWindow();
  15.   virtual void InitInstance();
  16. };
  17.  
  18. class TTestWindow : public TEditWindow
  19. {
  20. public:
  21.   TTestWindow(PTWindowsObject AParent, LPSTR ATitle);
  22.   virtual void CMSendText(RTMessage Msg)
  23.     = [CM_FIRST + CM_SENDTEXT];
  24. };
  25.  
  26. TTestWindow::TTestWindow(PTWindowsObject AParent, LPSTR ATitle)
  27.   : TEditWindow(AParent, ATitle)
  28. {
  29.   AssignMenu("COMMANDS");
  30. }
  31.  
  32. void TTestWindow::CMSendText(RTMessage)
  33. {
  34.   int Lines;
  35.   char Text[20];
  36.  
  37.   Lines = Editor->GetNumLines();
  38.   sprintf(Text, "%d lines sent", Lines);
  39.   MessageBox(HWindow, Text, "Message Sent", MB_OK);
  40. }
  41.  
  42. void TTestApp::InitMainWindow()
  43. {
  44.   MainWindow = new TTestWindow(NULL, Name);
  45. }
  46.  
  47. void TTestApp::InitInstance()
  48. {
  49.   TApplication::InitInstance();
  50.   HAccTable = LoadAccelerators(hInstance, "EDITCOMMANDS");
  51. }
  52.  
  53. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  54.   LPSTR lpCmdLine, int nCmdShow)
  55. {
  56.   TTestApp TestApp("Edit Window Tester", hInstance, hPrevInstance,
  57.     lpCmdLine, nCmdShow);
  58.   TestApp.Run();
  59.   return TestApp.Status;
  60. }
  61.