📄 callboard.cpp
字号:
// CallBoard.cpp : implementation file
//
#include "stdafx.h"
#include "Server.h"
#include "CallBoard.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CCallBoard dialog
CCallBoard::CCallBoard(CWnd* pParent /*=NULL*/)
: CDialog(CCallBoard::IDD, pParent)
{
m_pServerDlg = (CServerDlg*)pParent;
m_bExpandStatus = false;
//{{AFX_DATA_INIT(CCallBoard)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
CCallBoard::~CCallBoard()
{
}
void CCallBoard::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CCallBoard)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CCallBoard, CDialog)
//{{AFX_MSG_MAP(CCallBoard)
ON_BN_CLICKED(IDC_BTN_OK, OnBtnOk)
ON_WM_CLOSE()
ON_WM_DESTROY()
ON_BN_CLICKED(IDC_BTN_VIEWCALLLOG, OnBtnViewcalllog)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CCallBoard message handlers
void CCallBoard::OnCancel()
{
// TODO: Add extra cleanup here
OnDestroy();
}
///*************点了送公告信息发往客户端****************////
void CCallBoard::OnBtnOk()
{
// TODO: Add your control notification handler code here
CString Call;
CString Dptm;
GetDlgItemText(IDC_EDIT_CALL,Call);
GetDlgItemText(IDC_COMBO_DPTM,Dptm);
if(Call == "")
{
AfxMessageBox("公告内容不能为空!");
return;
}
if(Dptm == "")
{
AfxMessageBox("部门不能为空");
return;
}
if(m_pServerDlg->GetSvrSock().OnSendCall(Dptm, Call))
{
//AfxMessageBox("发送成功!"); /*dong 12-18*/
//OnCancel(); /*dong 12-17*/
GetDlgItem(IDC_EDIT_CALL)->SetWindowText("");
CString strTmp;
strTmp.Format("【系统公告】 %s\r\n %s\r\n\r\n",
m_pServerDlg->GetCurTime(), Call);
m_pServerDlg->GetCallBuff() += strTmp;
GetDlgItem(IDC_EDIT_CALLLOG)->SetWindowText(m_pServerDlg->GetCallBuff());
ExpandWindow(true);
m_bExpandStatus = true;
}
else
{
AfxMessageBox(Dptm + "人不在线!");
}
}
void CCallBoard::OnClose() /*dong 12-17*/
{
// TODO: Add your message handler code here and/or call default
OnDestroy();
}
BOOL CCallBoard::OnInitDialog()
{
CDialog::OnInitDialog();
GetDlgItem(IDC_EDIT_CALL)->SetFocus(); /*dong 12-17*/
ExpandWindow(false);
return false;
}
void CCallBoard::OnDestroy() /*dong 12-17*/
{
CDialog::OnDestroy();
m_pServerDlg->m_CallBoardHwnd = NULL;
delete this;
// TODO: Add your message handler code here
}
/*---------------------------------------------------------------------------
展开收缩 [Add] dong 12-16
--------------------------------------------------------------------------*/
void CCallBoard::ExpandWindow(bool bExpandStatus)
{
CRect dlgCurr; //当前窗口位置及大小
GetWindowRect(dlgCurr);
CWnd* pExpandPart = GetDlgItem(IDC_STC_FLAG);
CRect rtExpandPart; //展开部分
pExpandPart->GetWindowRect(rtExpandPart);
if(!bExpandStatus)
{
dlgCurr.bottom = rtExpandPart.top;
}
else
{
dlgCurr.bottom = rtExpandPart.bottom;
}
SetWindowPos(this, 0, 0, dlgCurr.Width(), dlgCurr.Height(),
SWP_NOMOVE|SWP_NOZORDER);
}
void CCallBoard::OnBtnViewcalllog()
{
// TODO: Add your control notification handler code here
m_bExpandStatus = ! m_bExpandStatus;
ExpandWindow(m_bExpandStatus);
if(m_bExpandStatus)
{
GetDlgItem(IDC_BTN_VIEWCALLLOG)->SetWindowText("隐藏记录");
}
else
{
GetDlgItem(IDC_BTN_VIEWCALLLOG)->SetWindowText("公告记录");
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -