home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgLangD.iso / C++-7 / DISK8 / MFC / SAMPLES / TESTCLNT / TESTS.CP$ / tests
Encoding:
Text File  |  1992-03-19  |  3.7 KB  |  200 lines

  1. // tests.cpp : This file contains code which just hasn't been introduced
  2. //        into the main program.  It is meant more as an experimental
  3. //        file.  It should be removed when development is completed.
  4. //
  5. // This is a part of the Microsoft Foundation Classes C++ library.
  6. // Copyright (C) 1992 Microsoft Corporation
  7. // All rights reserved.
  8. //
  9. // This source code is only intended as a supplement to the
  10. // Microsoft Foundation Classes Reference and Microsoft
  11. // QuickHelp documentation provided with the library.
  12. // See these sources for detailed information regarding the
  13. // Microsoft Foundation Classes product.
  14.  
  15. #include "testclnt.h"
  16. #include "resource.h"
  17. #include "defs.h"
  18.  
  19. #undef THIS_FILE
  20. static char THIS_FILE[] = __FILE__;
  21.  
  22. extern CStdioFile *pOleDump;
  23. static char szBuffer[80];
  24.  
  25.  
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CTestClient::OnLogging()
  28. //
  29.  
  30. void CTestClient::OnLogging()
  31. {
  32.     CMenu *pMenu;
  33.     pMenu = GetMenu();
  34.  
  35.     if (m_bLogging)
  36.     {
  37.         pMenu->CheckMenuItem(IDM_LOGGING, MF_UNCHECKED);
  38.         pOleDump->Flush();
  39.         pOleDump->Close();
  40.         delete pOleDump;
  41.         m_bLogging = !m_bLogging;
  42.     }
  43.     else
  44.     {
  45.  
  46.         pMenu->CheckMenuItem(IDM_LOGGING, MF_CHECKED);
  47.         pOleDump = new CStdioFile();
  48.         if (!pOleDump->Open("testclnt.log", CFile::typeText |
  49.             CFile::modeWrite | CFile::modeCreate))
  50.         {
  51.             TRACE("Logging File TESTCLNT.LOG not opened\n");
  52.         }
  53.         else
  54.         {
  55.             m_bLogging = !m_bLogging;
  56.         }
  57.     }
  58. }
  59.  
  60.  
  61. void CTestClient::OnCloseApi()
  62. {
  63.     ASSERT(m_pClient != NULL);
  64.  
  65.     TRY
  66.     {
  67.         m_pClient->CloseLink();
  68.     }
  69.     CATCH(CException, e)
  70.     {
  71.         MessageBox("An exception was thrown during this operation.  "
  72.             "Please exit the application and restart.", "Test Client",
  73.             MB_ICONEXCLAMATION);
  74.         return;
  75.     }
  76.     END_CATCH
  77. }
  78.  
  79.  
  80. void CTestClient::OnUpdateApi()
  81. {
  82.     ASSERT(m_pClient != NULL);
  83.  
  84.     TRY
  85.     {
  86.         m_pClient->UpdateLink();
  87.         Invalidate(TRUE);
  88.     }
  89.     CATCH(CException, e)
  90.     {
  91.         MessageBox("An exception was thrown during this operation.  "
  92.             "Please exit the application and restart.", "Test Client",
  93.             MB_ICONEXCLAMATION);
  94.         return;
  95.     }
  96.     END_CATCH
  97.  
  98. }
  99.  
  100.  
  101. void CTestClient::OnReleaseApi()
  102. {
  103.     ASSERT(m_pClient != NULL);
  104.  
  105.     TRY
  106.     {
  107.         m_pClient->Release();
  108.         Invalidate(TRUE);
  109.     }
  110.     CATCH(CException, e)
  111.     {
  112.         MessageBox("An exception was thrown during this operation.  "
  113.             "Please exit the application and restart.", "Test Client",
  114.             MB_ICONEXCLAMATION);
  115.         return;
  116.     }
  117.     END_CATCH
  118. }
  119.  
  120.  
  121.  
  122. void CTestClient::OnDeleteApi()
  123. {
  124.     ASSERT(m_pClient != NULL);
  125.  
  126.     TRY
  127.     {
  128.         m_pClient->Delete();
  129.         Invalidate(TRUE);
  130.     }
  131.     CATCH(CException, e)
  132.     {
  133.         MessageBox("An exception was thrown during this operation.  "
  134.             "Please exit the application and restart.", "Test Client",
  135.             MB_ICONEXCLAMATION);
  136.         return;
  137.     }
  138.     END_CATCH
  139. }
  140.  
  141.  
  142.  
  143. void CTestClient::OnReconnectApi()
  144. {
  145.     ASSERT(m_pClient != NULL);
  146.  
  147.     TRY
  148.     {
  149.         m_pClient->ReconnectLink();
  150.     }
  151.     CATCH(CException, e)
  152.     {
  153.         MessageBox("An exception was thrown during this operation.  "
  154.             "Please exit the application and restart.", "Test Client",
  155.             MB_ICONEXCLAMATION);
  156.         return;
  157.     }
  158.     END_CATCH
  159. }
  160.  
  161.  
  162.  
  163. void CTestClient::OnRevertApi()
  164. {
  165.     ASSERT(m_pDoc != NULL);
  166.  
  167.     TRY
  168.     {
  169.         m_pDoc->NotifyRevert();
  170.     }
  171.     CATCH(CException, e)
  172.     {
  173.         MessageBox("An exception was thrown during this operation.  "
  174.             "Please exit the application and restart.", "Test Client",
  175.             MB_ICONEXCLAMATION);
  176.         return;
  177.     }
  178.     END_CATCH
  179. }
  180.  
  181.  
  182.  
  183. void CTestClient::OnSavedApi()
  184. {
  185.     ASSERT(m_pDoc != NULL);
  186.  
  187.     TRY
  188.     {
  189.         m_pDoc->NotifySaved();
  190.     }
  191.     CATCH(CException, e)
  192.     {
  193.         MessageBox("An exception was thrown during this operation.  "
  194.             "Please exit the application and restart.", "Test Client",
  195.             MB_ICONEXCLAMATION);
  196.         return;
  197.     }
  198.     END_CATCH
  199. }
  200.