www.pudn.com > ChatSystem_src.zip > ChatView.cpp
// ChatView.cpp : implementation file
//
#include "stdafx.h"
#include "ChatServer.h"
#include "ChatView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CChatView
IMPLEMENT_DYNCREATE(CChatView, CView)
CChatView::CChatView()
{
}
CChatView::~CChatView()
{
}
BEGIN_MESSAGE_MAP(CChatView, CView)
//{{AFX_MSG_MAP(CChatView)
ON_WM_CHAR()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CChatView drawing
void CChatView::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
}
/////////////////////////////////////////////////////////////////////////////
// CChatView diagnostics
#ifdef _DEBUG
void CChatView::AssertValid() const
{
CView::AssertValid();
}
void CChatView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CChatView message handlers
void CChatView::OnInitialUpdate()
{
CView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
CRect rect;
GetClientRect(&rect);
m_EditBox.Create(WS_VISIBLE |
WS_BORDER |
WS_CHILD |
ES_MULTILINE,
rect, this , 0);
}
void CChatView::message(LPCTSTR lpszMessage)
{
CString strTemp = lpszMessage;
strTemp += _T("\r\n");
int len = m_EditBox.GetWindowTextLength();
m_EditBox.SetSel(len,len);
m_EditBox.ReplaceSel(strTemp);
}
void CChatView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
CView::OnChar(nChar, nRepCnt, nFlags);
}