MAPIConsumerView.cpp
上传用户:benben_wyd
上传日期:2010-02-26
资源大小:1229k
文件大小:3k
源码类别:

书籍源码

开发平台:

Visual C++

  1. // MAPIConsumerView.cpp : implementation of the CMAPIConsumerView class
  2. //
  3. #include "stdafx.h"
  4. #include "MAPIConsumer.h"
  5. #include "MAPIConsumerSet.h"
  6. #include "MAPIConsumerDoc.h"
  7. #include "MAPIConsumerView.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CMAPIConsumerView
  15. IMPLEMENT_DYNCREATE(CMAPIConsumerView, COleDBRecordView)
  16. BEGIN_MESSAGE_MAP(CMAPIConsumerView, COleDBRecordView)
  17. //{{AFX_MSG_MAP(CMAPIConsumerView)
  18. //}}AFX_MSG_MAP
  19. END_MESSAGE_MAP()
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CMAPIConsumerView construction/destruction
  22. CMAPIConsumerView::CMAPIConsumerView()
  23. : COleDBRecordView(CMAPIConsumerView::IDD)
  24. {
  25. //{{AFX_DATA_INIT(CMAPIConsumerView)
  26. // NOTE: the ClassWizard will add member initialization here
  27. m_pSet = NULL;
  28. //}}AFX_DATA_INIT
  29. }
  30. CMAPIConsumerView::~CMAPIConsumerView()
  31. {
  32. }
  33. void CMAPIConsumerView::DoDataExchange(CDataExchange* pDX)
  34. {
  35. COleDBRecordView::DoDataExchange(pDX);
  36. //{{AFX_DATA_MAP(CMAPIConsumerView)
  37. // NOTE: the ClassWizard will add DDX and DDV calls here
  38. //}}AFX_DATA_MAP
  39. //Added by Chuck Wood for data exchange support
  40. DDX_Text(pDX, IDC_SENDER, m_pSet->m_strAuthor, 50);
  41. DDX_Text(pDX, IDC_SUBJECT, m_pSet->m_strSubject, 256);
  42. DDX_Text(pDX, IDC_DATE, m_pSet->m_strDate, 20);
  43. DDX_Text(pDX, IDC_MESSAGE, m_pSet->m_strMessage, 1024);
  44. DDV_MaxChars(pDX, m_pSet->m_strAuthor, 50);
  45. DDV_MaxChars(pDX, m_pSet->m_strSubject, 256);
  46. DDV_MaxChars(pDX, m_pSet->m_strDate, 20);
  47. DDV_MaxChars(pDX, m_pSet->m_strMessage, 1024);
  48. }
  49. BOOL CMAPIConsumerView::PreCreateWindow(CREATESTRUCT& cs)
  50. {
  51. return COleDBRecordView::PreCreateWindow(cs);
  52. }
  53. void CMAPIConsumerView::OnInitialUpdate()
  54. {
  55. m_pSet = &GetDocument()->m_mAPIConsumerSet;
  56. {
  57. CWaitCursor wait;
  58. HRESULT hr = m_pSet->Open();
  59. if (hr != S_OK)
  60. {
  61. AfxMessageBox(_T("Record set failed to open."), MB_OK);
  62. m_bOnFirstRecord = TRUE;
  63. m_bOnLastRecord = TRUE;
  64. }
  65. }
  66. COleDBRecordView::OnInitialUpdate();
  67. }
  68. /////////////////////////////////////////////////////////////////////////////
  69. // CMAPIConsumerView diagnostics
  70. #ifdef _DEBUG
  71. void CMAPIConsumerView::AssertValid() const
  72. {
  73. COleDBRecordView::AssertValid();
  74. }
  75. void CMAPIConsumerView::Dump(CDumpContext& dc) const
  76. {
  77. COleDBRecordView::Dump(dc);
  78. }
  79. CMAPIConsumerDoc* CMAPIConsumerView::GetDocument() // non-debug version is inline
  80. {
  81. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMAPIConsumerDoc)));
  82. return (CMAPIConsumerDoc*)m_pDocument;
  83. }
  84. #endif //_DEBUG
  85. /////////////////////////////////////////////////////////////////////////////
  86. // CMAPIConsumerView database support
  87. CRowset* CMAPIConsumerView::OnGetRowset()
  88. {
  89. return m_pSet;
  90. }
  91. /////////////////////////////////////////////////////////////////////////////
  92. // CMAPIConsumerView message handlers