home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK11 / MFC / SAMPLES / MINSVRMI / MINSVRMI.H$ / minsvrmi
Encoding:
Text File  |  1992-03-16  |  2.6 KB  |  84 lines

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and Microsoft
  7. // QuickHelp documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10.  
  11.  
  12. // MinSvrMI.cpp : minimal OLE Server - Multiple Inheritance Example
  13.  
  14. /////////////////////////////////////////////////////////////////////////////
  15.  
  16. #include <afxole.h>
  17. #include "resource.h"
  18.  
  19. #define SERVER_NAME         "MINSVRMI"
  20. #define SERVER_LOCAL_NAME   "Mini OLE Server - MI Implementation"
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23.  
  24. // MiApp is-a Window - for the main window
  25. // MiApp is-an application - since we need one
  26. // MiApp is-an OLE Server - since we need one to do OLE
  27. // MiApp is-an OLE document - since there is one document per main window
  28. // MiApp is-an OLE item - since we need one for the OLE document
  29.  
  30. class CMiApp : public CFrameWnd,
  31.         public CWinApp,
  32.         public COleServer,
  33.         public COleServerDoc,
  34.         public COleServerItem
  35. {
  36. // Construction
  37. public:
  38.     CMiApp();
  39.  
  40. // Attributes
  41. public:
  42.     CString m_data;     // example of server item data
  43.  
  44. // Implementation
  45. protected:
  46.     // Window messages and commands
  47.     afx_msg LONG OnCloseWindow(UINT, LONG);
  48.     afx_msg void OnUpdateClient();
  49.     afx_msg void OnChangeString();
  50.     afx_msg void OnFileExit();
  51.     afx_msg void OnAbout();
  52.     DECLARE_MESSAGE_MAP()
  53. protected:
  54.     virtual void PostNcDestroy();       // for cleanup
  55.  
  56.     // App Overrides
  57.     BOOL InitInstance();
  58.  
  59.     // OLE Server overrides
  60.     virtual COleServerDoc* OnOpenDoc(LPCSTR lpszDoc);
  61.     virtual COleServerDoc* OnCreateDoc(LPCSTR lpszClass, LPCSTR lpszDoc);
  62.     virtual COleServerDoc* OnEditDoc(LPCSTR lpszClass, LPCSTR lpszDoc);
  63.  
  64.     // Document overrides
  65.     virtual COleServerItem* OnGetDocument();
  66.     virtual COleServerItem* OnGetItem(LPCSTR lpszItemName);
  67.     virtual COleServerItem* GetNextItem(POSITION& rPosition);
  68.  
  69.     // Item overrides
  70.     virtual OLESTATUS   OnShow(BOOL bTakeFocus);
  71.     virtual BOOL        OnDraw(CMetaFileDC* pDC);
  72.     virtual void        Serialize(CArchive& ar);        // for native data
  73.     virtual BOOL        OnGetTextData(CString& rStringReturn);
  74.  
  75. public: // necessary for having two or more CObject derived base classes
  76.     void* operator new(size_t nSize)
  77.         { return CFrameWnd::operator new(nSize); }
  78.     void operator delete(void* p)
  79.         { CFrameWnd::operator delete(p); }
  80. };
  81.  
  82. /////////////////////////////////////////////////////////////////////////////
  83.  
  84.