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

  1. // ObjectWindows - (C) Copyright 1992 by Borland International
  2.  
  3. #include <owl.h>
  4. #include <mdi.h>
  5.  
  6. // Define a TApplication descendant
  7. class TMDIApp : public TApplication {
  8. public:
  9.     TMDIApp(LPSTR name, HINSTANCE hInstance,
  10.           HINSTANCE hPrevInstance, LPSTR lpCmd,
  11.           int nCmdShow)
  12.             : TApplication(name, hInstance,
  13.                    hPrevInstance, lpCmd, nCmdShow) {};
  14.     virtual void InitMainWindow();
  15. };
  16.  
  17. // Define a TMDIFrame descendant
  18. class TMyMDIFrame : public TMDIFrame {
  19. public:
  20.   WORD ChildNum;
  21.  
  22.   TMyMDIFrame(LPSTR ATitle, LPSTR MenuName);
  23.   virtual PTWindowsObject InitChild();
  24. };
  25.  
  26. // Construct the TMDIApp's MainWindow object, loading its menu
  27. void TMDIApp::InitMainWindow()
  28. {
  29.   MainWindow = new TMyMDIFrame("MDI Conformist", "MDIMenu");
  30. }
  31.  
  32. TMyMDIFrame::TMyMDIFrame(LPSTR ATitle, LPSTR MenuName)
  33.              : TMDIFrame(ATitle, MenuName)
  34. {
  35.   ChildNum = 1;
  36. }
  37.  
  38. PTWindowsObject TMyMDIFrame::InitChild()
  39. {
  40.   char ChildName[14];
  41.  
  42.   wsprintf(ChildName,"MDI Child %d", ChildNum++);
  43.   return new TWindow(this, ChildName);
  44. }
  45.  
  46. // Run the MDIApp
  47. int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
  48.            LPSTR lpCmd, int nCmdShow)
  49. {
  50.     TMDIApp MDIApp ("MDIApp", hInstance, hPrevInstance,
  51.         lpCmd, nCmdShow);
  52.     MDIApp.Run();
  53.     return (MDIApp.Status);
  54. }
  55.