⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mapiconsumerview.cpp

📁 vc++6.0数据库编程大全一书得各个章节得源码,比较详细.可以仔细参照学习!
💻 CPP
字号:
// MAPIConsumerView.cpp : implementation of the CMAPIConsumerView class
//

#include "stdafx.h"
#include "MAPIConsumer.h"

#include "MAPIConsumerSet.h"
#include "MAPIConsumerDoc.h"
#include "MAPIConsumerView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMAPIConsumerView

IMPLEMENT_DYNCREATE(CMAPIConsumerView, COleDBRecordView)

BEGIN_MESSAGE_MAP(CMAPIConsumerView, COleDBRecordView)
	//{{AFX_MSG_MAP(CMAPIConsumerView)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMAPIConsumerView construction/destruction

CMAPIConsumerView::CMAPIConsumerView()
	: COleDBRecordView(CMAPIConsumerView::IDD)
{
	//{{AFX_DATA_INIT(CMAPIConsumerView)
		// NOTE: the ClassWizard will add member initialization here
	m_pSet = NULL;
	//}}AFX_DATA_INIT
}

CMAPIConsumerView::~CMAPIConsumerView()
{
}

void CMAPIConsumerView::DoDataExchange(CDataExchange* pDX)
{
	COleDBRecordView::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CMAPIConsumerView)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
	//Added by Chuck Wood for data exchange support
	DDX_Text(pDX, IDC_SENDER, m_pSet->m_strAuthor, 50);
	DDX_Text(pDX, IDC_SUBJECT, m_pSet->m_strSubject, 256);
	DDX_Text(pDX, IDC_DATE, m_pSet->m_strDate, 20);
	DDX_Text(pDX, IDC_MESSAGE, m_pSet->m_strMessage, 1024);
	DDV_MaxChars(pDX, m_pSet->m_strAuthor, 50);
	DDV_MaxChars(pDX, m_pSet->m_strSubject, 256);
	DDV_MaxChars(pDX, m_pSet->m_strDate, 20);
	DDV_MaxChars(pDX, m_pSet->m_strMessage, 1024);
}

BOOL CMAPIConsumerView::PreCreateWindow(CREATESTRUCT& cs)
{
	return COleDBRecordView::PreCreateWindow(cs);
}

void CMAPIConsumerView::OnInitialUpdate()
{
	m_pSet = &GetDocument()->m_mAPIConsumerSet;
	{
		CWaitCursor wait;
		HRESULT hr = m_pSet->Open();
		if (hr != S_OK)
		{
			AfxMessageBox(_T("Record set failed to open."), MB_OK);
			m_bOnFirstRecord = TRUE;
			m_bOnLastRecord = TRUE;
		}				
	}
	COleDBRecordView::OnInitialUpdate();

}

/////////////////////////////////////////////////////////////////////////////
// CMAPIConsumerView diagnostics

#ifdef _DEBUG
void CMAPIConsumerView::AssertValid() const
{
	COleDBRecordView::AssertValid();
}

void CMAPIConsumerView::Dump(CDumpContext& dc) const
{
	COleDBRecordView::Dump(dc);
}

CMAPIConsumerDoc* CMAPIConsumerView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMAPIConsumerDoc)));
	return (CMAPIConsumerDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMAPIConsumerView database support
CRowset* CMAPIConsumerView::OnGetRowset()
{
	return m_pSet;
}


/////////////////////////////////////////////////////////////////////////////
// CMAPIConsumerView message handlers

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -