home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c480 / 19.ddi / MFC / SAMPLES / VIEWEX / MAINDOC.CP_ / MAINDOC.CP
Encoding:
Text File  |  1993-02-08  |  1.9 KB  |  79 lines

  1. // maindoc.cpp : implementation of the CMainDoc class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and Microsoft
  9. // QuickHelp and/or WinHelp documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12.  
  13.  
  14.  
  15. #include "stdafx.h"
  16. #include "viewex.h"
  17.  
  18. #include "enterdlg.h"
  19.  
  20. #ifdef _DEBUG
  21. #undef THIS_FILE
  22. static char BASED_CODE THIS_FILE[] = __FILE__;
  23. #endif
  24.  
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CMainDoc
  27.  
  28. IMPLEMENT_SERIAL(CMainDoc, CDocument, 0 /* schema number*/ )
  29.  
  30. BEGIN_MESSAGE_MAP(CMainDoc, CDocument)
  31.     //{{AFX_MSG_MAP(CMainDoc)
  32.     ON_COMMAND(IDM_CHANGEDATA, OnChangeData)
  33.     //}}AFX_MSG_MAP
  34. END_MESSAGE_MAP()
  35.  
  36. /////////////////////////////////////////////////////////////////////////////
  37. // CMainDoc construction/destruction
  38.  
  39. CMainDoc::CMainDoc()
  40. {
  41. }
  42.  
  43. CMainDoc::~CMainDoc()
  44. {
  45. }
  46.  
  47. BOOL CMainDoc::OnNewDocument()
  48. {
  49.     if (!CDocument::OnNewDocument())
  50.         return FALSE;
  51.     m_strData = "Sample Data String";
  52.     m_colorData = RGB(0, 0, 0);
  53.     return TRUE;
  54. }
  55.  
  56. /////////////////////////////////////////////////////////////////////////////
  57. // CMainDoc serialization
  58.  
  59. void CMainDoc::Serialize(CArchive&)
  60. {
  61.     ASSERT(FALSE);      // this example program does not store data
  62. }
  63.  
  64. /////////////////////////////////////////////////////////////////////////////
  65. // CMainDoc commands
  66.  
  67. void CMainDoc::OnChangeData()
  68. {
  69.     CEnterDlg dlg;
  70.     dlg.m_strInput = m_strData;
  71.     if (dlg.DoModal() != IDOK)
  72.         return;
  73.     m_strData = dlg.m_strInput;
  74.     // if this document stored data then we would call SetModifiedFlag here
  75.     UpdateAllViews(NULL);   // general update
  76. }
  77.  
  78. /////////////////////////////////////////////////////////////////////////////
  79.