home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1996 December / PCWKCD1296.iso / vjplusb / msdev / bin / mfcclswz.dll / SRCDATA / DOC.CPP < prev    next >
Encoding:
Text File  |  1996-07-12  |  2.7 KB  |  128 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. // %1
  3.  
  4. IMPLEMENT_DYNCREATE(%1, %2)
  5.  
  6. %1::%1()
  7. {
  8. $$IF(OLEAUTO)
  9.     EnableAutomation();
  10. $$ENDIF
  11. $$IF(OLECREATE)
  12.     
  13.     // To keep the application running as long as an OLE automation 
  14.     //    object is active, the constructor calls AfxOleLockApp.
  15.     
  16.     AfxOleLockApp();
  17. $$ENDIF
  18. }
  19.  
  20. BOOL %1::OnNewDocument()
  21. {
  22.     if (!%2::OnNewDocument())
  23.         return FALSE;
  24.     return TRUE;
  25. }
  26.  
  27. %1::~%1()
  28. {
  29. $$IF(OLECREATE)
  30.     // To terminate the application when all objects created with
  31.     //     with OLE automation, the destructor calls AfxOleUnlockApp.
  32.     
  33.     AfxOleUnlockApp();
  34. $$ENDIF
  35. }
  36. $$IF(OLEAUTO)
  37.  
  38. void %1::OnFinalRelease()
  39. {
  40.     // When the last reference for an automation object is released
  41.     // OnFinalRelease is called.  The base class will automatically
  42.     // deletes the object.  Add additional cleanup required for your
  43.     // object before calling the base class.
  44.  
  45.     %2::OnFinalRelease();
  46. }
  47. $$ENDIF
  48. $$IF(OLESERVERDOC)
  49.  
  50. COleServerItem* %1::OnGetEmbeddedItem()
  51. {
  52.     // OnGetEmbeddedItem is called by the framework to get the COleServerItem
  53.     //  that is associated with the document.  It is only called when necessary.
  54.  
  55.     // Instead of returning NULL, return a pointer to a new COleServerItem
  56.     //  derived class that is used in conjunction with this document, then
  57.     //  remove the ASSERT(FALSE) below.
  58.     //  (i.e., return new CMyServerItem.)
  59.     ASSERT(FALSE);            // remove this after completing the TODO
  60.     return NULL;
  61. }
  62. $$ENDIF
  63.  
  64.  
  65. BEGIN_MESSAGE_MAP(%1, %2)
  66.     //{{AFX_MSG_MAP(%1)
  67.         // NOTE - the ClassWizard will add and remove mapping macros here.
  68.     //}}AFX_MSG_MAP
  69. END_MESSAGE_MAP()
  70. $$IF(OLEAUTO)
  71.  
  72. BEGIN_DISPATCH_MAP(%1, %2)
  73.     //{{AFX_DISPATCH_MAP(%1)
  74.         // NOTE - the ClassWizard will add and remove mapping macros here.
  75.     //}}AFX_DISPATCH_MAP
  76. END_DISPATCH_MAP()
  77.  
  78. // Note: we add support for IID_I%c to support typesafe binding
  79. //  from VBA.  This IID must match the GUID that is attached to the 
  80. //  dispinterface in the .ODL file.
  81.  
  82. // {%b}
  83. static const IID IID_I%c =
  84. %d;
  85.  
  86. BEGIN_INTERFACE_MAP(%1, %2)
  87.     INTERFACE_PART(%1, IID_I%c, Dispatch)
  88. END_INTERFACE_MAP()
  89. $$ENDIF //OLEAUTO
  90. $$IF(OLECREATE)
  91.  
  92. // {%e}
  93. IMPLEMENT_OLECREATE(%1, "%6", %7)
  94. $$ENDIF //OLECREATE
  95.  
  96. /////////////////////////////////////////////////////////////////////////////
  97. // %1 diagnostics
  98.  
  99. #ifdef _DEBUG
  100. void %1::AssertValid() const
  101. {
  102.     %2::AssertValid();
  103. }
  104.  
  105. void %1::Dump(CDumpContext& dc) const
  106. {
  107.     %2::Dump(dc);
  108. }
  109. #endif //_DEBUG
  110.  
  111. /////////////////////////////////////////////////////////////////////////////
  112. // %1 serialization
  113.  
  114. void %1::Serialize(CArchive& ar)
  115. {
  116.     if (ar.IsStoring())
  117.     {
  118.         // TODO: add storing code here
  119.     }
  120.     else
  121.     {
  122.         // TODO: add loading code here
  123.     }
  124. }
  125.  
  126. /////////////////////////////////////////////////////////////////////////////
  127. // %1 commands