ChatEdit.cpp
资源名称:毕业论文--五子棋.zip [点击查看]
上传用户:fjjkzlh
上传日期:2010-04-06
资源大小:469k
文件大小:1k
源码类别:
棋牌游戏
开发平台:
Visual C++
- // ChatEdit.cpp : implementation file
- //
- #include "stdafx.h"
- #include "five.h"
- #include "ChatEdit.h"
- #include "Table.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CChatEdit
- CChatEdit::CChatEdit()
- {
- }
- CChatEdit::~CChatEdit()
- {
- }
- BEGIN_MESSAGE_MAP(CChatEdit, CEdit)
- //{{AFX_MSG_MAP(CChatEdit)
- ON_WM_KEYDOWN()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CChatEdit message handlers
- void CChatEdit::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
- {
- // TODO: Add your message handler code here and/or call default
- if ( '6' == nChar )
- {
- CTable *pTable = (CTable *)( AfxGetMainWnd()->GetDlgItem( IDC_TABLE ) );
- // 发送聊天信息
- TCHAR str[128];
- GetWindowText( str, 128 );
- pTable->Chat( str );
- // 写入聊天记录
- CEdit *pEdit = (CEdit *)( AfxGetMainWnd()->GetDlgItem( IDC_EDT_CHAT ) );
- CString strAdd;
- strAdd.Format( _T("你 说:%srn"), str );
- pEdit->SetSel( -1, -1, TRUE );
- pEdit->ReplaceSel( str );
- SetWindowText( _T("") );
- }
- else
- {
- CEdit::OnKeyDown(nChar, nRepCnt, nFlags);
- }
- }