www.pudn.com > TreeCtrlDB.rar > ShengView.cpp


// ShengView.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Ppp.h" 
#include "ShengView.h" 
#include"pppdoc.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CShengView 
 
IMPLEMENT_DYNCREATE(CShengView, CDaoRecordView) 
 
CShengView::CShengView() 
	: CDaoRecordView(CShengView::IDD) 
{ 
	//{{AFX_DATA_INIT(CShengView) 
	m_pSet = NULL; 
	//}}AFX_DATA_INIT 
} 
 
CShengView::~CShengView() 
{ 
} 
 
void CShengView::DoDataExchange(CDataExchange* pDX) 
{ 
	CDaoRecordView::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CShengView) 
	DDX_FieldText(pDX, IDC_EDIT1, m_pSet->m_column1, m_pSet); 
	DDX_FieldText(pDX, IDC_EDIT2, m_pSet->m_column2, m_pSet); 
	DDX_FieldText(pDX, IDC_EDIT3, m_pSet->m_column3, m_pSet); 
	DDX_FieldText(pDX, IDC_EDIT4, m_pSet->m_column4, m_pSet); 
	DDX_FieldText(pDX, IDC_EDIT5, m_pSet->m_column5, m_pSet); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CShengView, CDaoRecordView) 
	//{{AFX_MSG_MAP(CShengView) 
	ON_WM_TIMER() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CShengView diagnostics 
 
#ifdef _DEBUG 
void CShengView::AssertValid() const 
{ 
	CDaoRecordView::AssertValid(); 
} 
 
void CShengView::Dump(CDumpContext& dc) const 
{ 
	CDaoRecordView::Dump(dc); 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CShengView message handlers 
 
CDaoRecordset* CShengView::OnGetRecordset() 
{ 
	if (m_pSet != NULL) 
		return m_pSet; 
 
	m_pSet = new CShengSet(NULL); 
	m_pSet->Open(); 
 
	return m_pSet; 
} 
 
CShengSet* CShengView::GetRecordset() 
{ 
	CShengSet* pData = (CShengSet*) OnGetRecordset(); 
	ASSERT(pData == NULL || pData->IsKindOf(RUNTIME_CLASS(CShengSet))); 
	return pData; 
} 
 
void CShengView::OnInitialUpdate() 
{	 
	CDaoRecordView::OnInitialUpdate(); 
	 
	//if(SetTimer(1,10,NULL)==0) 
	   //MessageBox("1111"); 
    SetTimer(1,10,NULL); 
} 
 
void CShengView::OnTimer(UINT nIDEvent)  
{ 
	// TODO: Add your message handler code here and/or call default 
	CDaoRecordView::OnTimer(nIDEvent); 
	CPppDoc* pDoc = (CPppDoc*)GetDocument(); 
	 
	 
	if(m_pSet->IsOpen()) 
	{ 
		char filter[60]; 
      wsprintf(filter,"[Ê¡].Ê¡Ãû³Æ='%s'",pDoc->Name); 
      m_pSet->m_strFilter=filter; 
      m_pSet->Requery(); 
	  UpdateData(FALSE); 
	} 
 
}