Doc.cpp
上传用户:nhyuejuan
上传日期:2013-12-02
资源大小:171k
文件大小:2k
源码类别:

状态条

开发平台:

Visual C++

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Project:PGRSBAR
  3. // Author:NorthTibet
  4. // Date:星期二, 十二月 31, 2002
  5. // Description:在状态栏例实现进程指示器控制。
  6. //
  7. /////////////////////////////////////////////////////////////////////////////
  8. // Doc.cpp : implementation of the CMyDoc class
  9. //
  10. #include "stdafx.h"
  11. #include "pgrsbar.h"
  12. #include "Doc.h"
  13. #ifdef _DEBUG
  14. #define new DEBUG_NEW
  15. #undef THIS_FILE
  16. static char THIS_FILE[] = __FILE__;
  17. #endif
  18. /////////////////////////////////////////////////////////////////////////////
  19. // CMyDoc
  20. IMPLEMENT_DYNCREATE(CMyDoc, CDocument)
  21. BEGIN_MESSAGE_MAP(CMyDoc, CDocument)
  22. //{{AFX_MSG_MAP(CMyDoc)
  23. // NOTE - the ClassWizard will add and remove mapping macros here.
  24. //    DO NOT EDIT what you see in these blocks of generated code!
  25. //}}AFX_MSG_MAP
  26. END_MESSAGE_MAP()
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CMyDoc construction/destruction
  29. CMyDoc::CMyDoc()
  30. {
  31. // TODO: add one-time construction code here
  32. }
  33. CMyDoc::~CMyDoc()
  34. {
  35. }
  36. BOOL CMyDoc::OnNewDocument()
  37. {
  38. if (!CDocument::OnNewDocument())
  39. return FALSE;
  40. ((CEditView*)m_viewList.GetHead())->SetWindowText(NULL);
  41. // TODO: add reinitialization code here
  42. // (SDI documents will reuse this document)
  43. return TRUE;
  44. }
  45. /////////////////////////////////////////////////////////////////////////////
  46. // CMyDoc serialization
  47. void CMyDoc::Serialize(CArchive& ar)
  48. {
  49. /*
  50. // CEditView contains an edit control which handles all serialization
  51. ((CEditView*)m_viewList.GetHead())->SerializeRaw(ar);
  52. */
  53. CWnd* pFrame = AfxGetMainWnd();
  54. if (!ar.IsStoring()) {
  55. // loading: simulate length operation by sleeping, but wake up
  56. // every 150 msec to notify frame of progress.
  57. //
  58. for (int pct=10; pct<=100; pct+=10) {
  59. Sleep(150);
  60. if (pFrame)
  61. pFrame->SendMessage(MYWM_PROGRESS, pct);
  62. }
  63. }
  64. if (pFrame)
  65. pFrame->SendMessage(MYWM_PROGRESS, 0);
  66. ((CEditView*)m_viewList.GetHead())->SerializeRaw(ar);
  67. }
  68. /////////////////////////////////////////////////////////////////////////////
  69. // CMyDoc diagnostics
  70. #ifdef _DEBUG
  71. void CMyDoc::AssertValid() const
  72. {
  73. CDocument::AssertValid();
  74. }
  75. void CMyDoc::Dump(CDumpContext& dc) const
  76. {
  77. CDocument::Dump(dc);
  78. }
  79. #endif //_DEBUG
  80. /////////////////////////////////////////////////////////////////////////////
  81. // CMyDoc commands