home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK8 / MFC / SAMPLES / TESTCLNT / NEWCLNT.CP$ / newclnt
Encoding:
Text File  |  1992-03-07  |  2.3 KB  |  98 lines

  1. // newclnt.cpp : This file contains code which controls CNewClient which
  2. //      is an override of COleClient.  It handles callbacks from
  3. //      the OLE DLLs
  4. // This is a part of the Microsoft Foundation Classes C++ library.
  5. // Copyright (C) 1992 Microsoft Corporation
  6. // All rights reserved.
  7. //
  8. // This source code is only intended as a supplement to the
  9. // Microsoft Foundation Classes Reference and Microsoft
  10. // QuickHelp documentation provided with the library.
  11. // See these sources for detailed information regarding the
  12. // Microsoft Foundation Classes product.
  13.  
  14. #include "resource.h"
  15. #include "testclnt.h"
  16. #include "defs.h"
  17.  
  18. extern CStdioFile *pOleDump;
  19. static char szBuffer[80];
  20.  
  21.  
  22. /////////////////////////////////////////////////////////////////////////////
  23. // CNewClient::CNewClient(CTestClient* pParent, CNewClientDoc* pDoc)
  24. //
  25. CNewClient::CNewClient(CTestClient* pParent, CNewClientDoc* pDoc) :
  26.     COleClientItem(pDoc)
  27. {
  28.     m_pTestClient = pParent;
  29. }
  30.  
  31.  
  32.  
  33.  
  34. /////////////////////////////////////////////////////////////////////////////
  35. // CNewClient::OnChange()
  36. //
  37. void CNewClient::OnChange(OLE_NOTIFICATION wNotification)
  38. {
  39.     char szNoteName[20];
  40.  
  41.     ASSERT(m_pTestClient != NULL);
  42.  
  43.     switch (wNotification)
  44.     {
  45.         case OLE_CHANGED:
  46.             strcpy(szNoteName,"OLE_CHANGED");
  47.             break;
  48.  
  49.         case OLE_CLOSED:
  50.             m_pTestClient->OnChanged();
  51.             strcpy(szNoteName,"OLE_CLOSED");
  52.             break;
  53.  
  54.         case OLE_SAVED:
  55.             m_pTestClient->OnChanged();
  56.                 // we want to invalidate the client area as an action
  57.                 // has been performed.
  58.             strcpy(szNoteName,"OLE_SAVED");
  59.             break;
  60.  
  61.         default:
  62.             ASSERT(FALSE);  // should never get here
  63.     }
  64.  
  65.  
  66.     if (m_pTestClient->m_bLogging)
  67.     {
  68.         ASSERT (pOleDump != NULL);
  69.         wsprintf(szBuffer, 
  70.             "An %s message has been processed in CNewClient::OnChange()\n",
  71.                 (LPCSTR)szNoteName);
  72.         pOleDump->WriteString(szBuffer);
  73.     }
  74. }
  75.  
  76.  
  77. /////////////////////////////////////////////////////////////////////////////
  78. // CNewClient::OnRenamed()
  79. //
  80. void CNewClient::OnRenamed()
  81. {
  82.     ASSERT(m_pTestClient != NULL);
  83.  
  84.     COleClientItem::OnRenamed();
  85.     if (m_pTestClient->m_bLogging)
  86.     {
  87.         ASSERT (pOleDump != NULL);
  88.         strcpy(szBuffer, 
  89.             "An OLE_RENAMED message has been processed in CNewClient::OnRenamed()\n");
  90.         pOleDump->WriteString(szBuffer);
  91.     }
  92. }
  93.  
  94.  
  95.  
  96.  
  97.  
  98.