www.pudn.com > 200410111016053551.rar > TCPServerView.cpp


// TCPServerView.cpp : implementation of the CTCPServerView class 
// 
 
#include "stdafx.h" 
#include "TCPServer.h" 
 
#include "TCPServerDoc.h" 
#include "TCPServerView.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CTCPServerView 
 
IMPLEMENT_DYNCREATE(CTCPServerView, CEditView) 
 
BEGIN_MESSAGE_MAP(CTCPServerView, CEditView) 
	//{{AFX_MSG_MAP(CTCPServerView) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CTCPServerView construction/destruction 
 
CTCPServerView::CTCPServerView() 
{ 
	// TODO: add construction code here 
} 
 
 
CTCPServerView::~CTCPServerView() 
{ 
} 
 
BOOL CTCPServerView::PreCreateWindow(CREATESTRUCT& cs) 
{ 
	// TODO: Modify the Window class or styles here by modifying 
	//  the CREATESTRUCT cs 
 
	BOOL bPreCreated = CEditView::PreCreateWindow(cs); 
	cs.style = AFX_WS_DEFAULT_VIEW | WS_VSCROLL | ES_AUTOHSCROLL | 
		ES_AUTOVSCROLL | ES_MULTILINE | ES_NOHIDESEL;// | ES_UPPERCASE | ES_READONLY; 
	cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL);	// Enable word-wrapping 
 
	return bPreCreated; 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CTCPServerView drawing 
 
void CTCPServerView::OnDraw(CDC* pDC) 
{ 
	CTCPServerDoc* pDoc = GetDocument(); 
	ASSERT_VALID(pDoc); 
	// TODO: add draw code for native data here 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CTCPServerView diagnostics 
 
#ifdef _DEBUG 
void CTCPServerView::AssertValid() const 
{ 
	CEditView::AssertValid(); 
} 
 
void CTCPServerView::Dump(CDumpContext& dc) const 
{ 
	CEditView::Dump(dc); 
} 
 
CTCPServerDoc* CTCPServerView::GetDocument() // non-debug version is inline 
{ 
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CTCPServerDoc))); 
	return (CTCPServerDoc*)m_pDocument; 
} 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CTCPServerView message handlers 
void CTCPServerView::WriteString(LPCTSTR lpszMessage) 
{ 
	CString strTemp = lpszMessage; 
//	strTemp += _T("\r\n"); 
	int len = GetWindowTextLength(); 
	GetEditCtrl().SetSel(len,len); 
	GetEditCtrl().ReplaceSel(strTemp); 
}