www.pudn.com > 200410111016053551.rar > SendVw.cpp
// SendVw.cpp : implementation file
//
#include "stdafx.h"
#include "TCPServer.h"
#include "SendVw.h"
#include "Des.h"
#include "TCPServerDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CSendEdit
IMPLEMENT_DYNCREATE(CSendEdit, CEditView)
CSendEdit::CSendEdit()
{
}
CSendEdit::~CSendEdit()
{
}
BEGIN_MESSAGE_MAP(CSendEdit, CEditView)
//{{AFX_MSG_MAP(CSendEdit)
ON_WM_CHAR()
ON_COMMAND(ID_MENUITEMBACK, OnMenuitemback)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CSendEdit drawing
void CSendEdit::OnDraw(CDC* pDC)
{
CDocument* pDoc = GetDocument();
// TODO: add draw code here
}
/////////////////////////////////////////////////////////////////////////////
// CSendEdit diagnostics
#ifdef _DEBUG
void CSendEdit::AssertValid() const
{
CEditView::AssertValid();
}
void CSendEdit::Dump(CDumpContext& dc) const
{
CEditView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CSendEdit message handlers
void CSendEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
if ((nChar != VK_RETURN) || (nRepCnt!=1))
{
CEditView::OnChar(nChar, nRepCnt, nFlags);
return;
}
else
{
OnMenuitemback();
}
}
BOOL CSendEdit::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Add your specialized code here and/or call the base class
BOOL bPreCreated = CEditView::PreCreateWindow(cs);
cs.style = AFX_WS_DEFAULT_VIEW | WS_VSCROLL | ES_AUTOHSCROLL |
ES_AUTOVSCROLL | ES_MULTILINE | ES_NOHIDESEL;
cs.style &= ~(ES_AUTOHSCROLL|WS_HSCROLL); // Enable word-wrapping
return bPreCreated;
}
void CSendEdit::OnMenuitemback()
{
// TODO: Add your command handler code here
CString strText;
GetEditCtrl().GetWindowText(strText);
CTCPServerDoc *pDoc = (CTCPServerDoc *)GetDocument();
pDoc->SendData((char *)LPCTSTR(strText));
// strText=_T("");
// GetEditCtrl().SetWindowText(strText);
}