www.pudn.com > ChatSystem_src.zip > MessageView.cpp


// MessageView.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "ChatClient.h" 
#include "MessageView.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CMessageView 
 
IMPLEMENT_DYNCREATE(CMessageView, CEditView) 
 
CMessageView::CMessageView() 
{ 
} 
 
CMessageView::~CMessageView() 
{ 
} 
 
 
BEGIN_MESSAGE_MAP(CMessageView, CEditView) 
	//{{AFX_MSG_MAP(CMessageView) 
	ON_WM_CHAR() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CMessageView drawing 
 
void CMessageView::OnDraw(CDC* pDC) 
{ 
	CDocument* pDoc = GetDocument(); 
	// TODO: add draw code here 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CMessageView diagnostics 
 
#ifdef _DEBUG 
void CMessageView::AssertValid() const 
{ 
	CEditView::AssertValid(); 
} 
 
void CMessageView::Dump(CDumpContext& dc) const 
{ 
	CEditView::Dump(dc); 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CMessageView message handlers 
 
 
void CMessageView::Message(LPCTSTR lpszMessage) 
{ 
	CString strTemp = lpszMessage; 
	strTemp += _T("\r\n"); 
	int len = GetWindowTextLength(); 
	GetEditCtrl().SetSel(len,len); 
	GetEditCtrl().ReplaceSel(strTemp); 
 
} 
 
BOOL CMessageView::PreCreateWindow(CREATESTRUCT& cs)  
{ 
	// TODO: Add your specialized code here and/or call the base class 
	BOOL ret = CEditView::PreCreateWindow(cs); 
	cs.style = AFX_WS_DEFAULT_VIEW |  
		       WS_VSCROLL |  
		       ES_AUTOVSCROLL |  
			   ES_MULTILINE |  
			   ES_NOHIDESEL; 
 
	return ret; 
 
} 
 
void CMessageView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)  
{ 
	// TODO: Add your message handler code here and/or call default 
	return; 
	CEditView::OnChar(nChar, nRepCnt, nFlags); 
}