Init: Migrate SimpleRemoter (Since v1.3.1) to Gitea
This commit is contained in:
106
server/2015Remote/TalkDlg.cpp
Normal file
106
server/2015Remote/TalkDlg.cpp
Normal file
@@ -0,0 +1,106 @@
|
||||
// TalkDlg.cpp : 实现文件
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "2015Remote.h"
|
||||
#include "TalkDlg.h"
|
||||
#include "afxdialogex.h"
|
||||
|
||||
// CTalkDlg 对话框
|
||||
|
||||
IMPLEMENT_DYNAMIC(CTalkDlg, CDialog)
|
||||
|
||||
CTalkDlg::CTalkDlg(CWnd* pParent, Server* IOCPServer, CONTEXT_OBJECT* ContextObject)
|
||||
: DialogBase(CTalkDlg::IDD, pParent, IOCPServer, ContextObject, IDR_MAINFRAME)
|
||||
{
|
||||
}
|
||||
|
||||
CTalkDlg::~CTalkDlg()
|
||||
{
|
||||
}
|
||||
|
||||
void CTalkDlg::DoDataExchange(CDataExchange* pDX)
|
||||
{
|
||||
__super::DoDataExchange(pDX);
|
||||
DDX_Control(pDX, IDC_EDIT_TALK, m_EditTalk);
|
||||
m_EditTalk.SetLimitText(TALK_DLG_MAXLEN);
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTalkDlg, CDialog)
|
||||
ON_BN_CLICKED(IDC_BUTTON_TALK, &CTalkDlg::OnBnClickedButtonTalk)
|
||||
ON_WM_CLOSE()
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
// CTalkDlg 消息处理程序
|
||||
|
||||
|
||||
BOOL CTalkDlg::OnInitDialog()
|
||||
{
|
||||
__super::OnInitDialog();
|
||||
// 多语言翻译 - Static控件
|
||||
SetDlgItemText(IDC_STATIC_TALK_MESSAGE, _TR("即时消息"));
|
||||
|
||||
// 设置对话框标题和控件文本(解决英语系统乱码问题)
|
||||
SetWindowText(_TR("即时消息"));
|
||||
SetDlgItemText(IDC_BUTTON_TALK, _TR("发送"));
|
||||
|
||||
SetIcon(m_hIcon, FALSE);
|
||||
BYTE bToken = COMMAND_NEXT;
|
||||
m_ContextObject->Send2Client(&bToken, sizeof(BYTE));
|
||||
|
||||
return TRUE; // return TRUE unless you set the focus to a control
|
||||
// 异常: OCX 属性页应返回 FALSE
|
||||
}
|
||||
|
||||
|
||||
void CTalkDlg::OnBnClickedButtonTalk()
|
||||
{
|
||||
int iLength = m_EditTalk.GetWindowTextLength();
|
||||
|
||||
if (!iLength) {
|
||||
return;
|
||||
}
|
||||
|
||||
CString strData;
|
||||
m_EditTalk.GetWindowText(strData);
|
||||
|
||||
char szBuffer[4096] = {0};
|
||||
strcpy(szBuffer,strData.GetBuffer(0));
|
||||
|
||||
m_EditTalk.SetWindowText(NULL);
|
||||
|
||||
m_ContextObject->Send2Client((LPBYTE)szBuffer, strlen(szBuffer));
|
||||
}
|
||||
|
||||
|
||||
BOOL CTalkDlg::PreTranslateMessage(MSG* pMsg)
|
||||
{
|
||||
if (pMsg->message == WM_KEYDOWN) {
|
||||
// 屏蔽VK_ESCAPE、VK_DELETE
|
||||
if (pMsg->wParam == VK_ESCAPE)
|
||||
return true;
|
||||
//如果是可编辑框的回车键
|
||||
if (pMsg->wParam == VK_RETURN && pMsg->hwnd == m_EditTalk.m_hWnd) {
|
||||
OnBnClickedButtonTalk();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return __super::PreTranslateMessage(pMsg);
|
||||
}
|
||||
|
||||
|
||||
void CTalkDlg::OnClose()
|
||||
{
|
||||
CancelIO();
|
||||
// 等待数据处理完毕
|
||||
if (IsProcessing()) {
|
||||
ShowWindow(SW_HIDE);
|
||||
return;
|
||||
}
|
||||
|
||||
DialogBase::OnClose();
|
||||
}
|
||||
Reference in New Issue
Block a user