home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0040 - 0049 / ibm0040-0049 / ibm0040.tar / ibm0040 / BCPPOWL1.ZIP / OWLDEMOS.ZIP / MDIAPP.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-28  |  1.4 KB  |  61 lines

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