📄 listendlg.cpp
字号:
// ListenDlg.cpp : implementation file
//
#include "stdafx.h"
#include "Record.h"
#include "ListenDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CListenDlg dialog
CListenDlg::CListenDlg(CWnd* pParent /*=NULL*/)
: CDialog(CListenDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CListenDlg)
//}}AFX_DATA_INIT
}
void CListenDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CListenDlg)
DDX_Control(pDX, IDC_COMBO_LISTEN, m_cmbListen);
DDX_Control(pDX, IDC_COMBO_LISTENED, m_cmbListened);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CListenDlg, CDialog)
//{{AFX_MSG_MAP(CListenDlg)
ON_BN_CLICKED(IDC_BUTTON1, OnButtonListenTo)
ON_BN_CLICKED(IDC_BUTTON2, OnButtonStopListenTo)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CListenDlg message handlers
BOOL CListenDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
char szTmp[10];
int nMaxCh;
nMaxCh = SsmGetMaxCh(); //retrieve channel amounts declared in configuration file
if(nMaxCh == -1)
{
WriteLog("failed to call function SsmGetMaxCh()");
}
for(int ch=0, i=0, j=0; ch<nMaxCh; ch++)
{
int nResult = SsmGetChType(ch); //retrieve channel type
if(nResult == -1)
{
WriteLog("failed to call function SsmGetChType()");
}
else if((nResult != 20) && (nResult != -1)) // value "20" indicates that no module is installed on stated channel
{
m_cmbListen.InsertString(i++, _itoa(ch, szTmp, 10));
m_cmbListened.InsertString(j++, _itoa(ch, szTmp, 10));
}
}
m_cmbListen.SetCurSel(0);
m_cmbListened.SetCurSel(0);
InitLab();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CListenDlg::OnButtonListenTo() //Listen
{
// TODO: Add your control notification handler code here
int nListen;
int nListened;
char szErrMsg[200];
char sz1[10];
char sz2[10];
memset(sz1, 0, sizeof(char)*10);
memset(sz2, 0, sizeof(char)*10);
m_cmbListen.GetLBText(m_cmbListen.GetCurSel(), sz1);
nListen = atoi(sz1);
m_cmbListened.GetLBText(m_cmbListened.GetCurSel(), sz2);
nListened = atoi(sz2);
if(SsmListenTo(nListened, nListen) == -1) //channel nListen is to listen channel nListened
{
SsmGetLastErrMsg(szErrMsg); //retrieve error message
AfxMessageBox(szErrMsg, MB_OK, 0);
}
}
void CListenDlg::OnButtonStopListenTo() //stop listening
{
// TODO: Add your control notification handler code here
int nListen;
int nListened;
char szErrMsg[200];
char sz1[10];
char sz2[10];
memset(sz1, 0, sizeof(char)*10);
memset(sz2, 0, sizeof(char)*10);
m_cmbListen.GetLBText(m_cmbListen.GetCurSel(), sz1);
nListen = atoi(sz1);
m_cmbListened.GetLBText(m_cmbListened.GetCurSel(), sz2);
nListened = atoi(sz2);
if(SsmStopListenTo(nListened, nListen) == -1) //channel nListen stop listening channel nListened
{
SsmGetLastErrMsg(szErrMsg); //retrieve error message
AfxMessageBox(szErrMsg, MB_OK, 0);
}
}
void CListenDlg::InitLab()
{
if(g_dwLanguageConversion == g_dwCHINESE_SIMPLIFIED)
{
//Chinese
strLab[0].Format("监听");
strLab[1].Format("监听通道");
strLab[2].Format("被监听通道");
}
else
{ //English
strLab[0].Format("Listen");
strLab[1].Format("Id of listening channel");
strLab[2].Format("Id of channel listened");
}
SetWinTextLab(this, IDC_STATIC_LISTEN , strLab[0]);
SetWinTextLab(this, IDC_STATIC_LISTENCH , strLab[1]);
SetWinTextLab(this, IDC_STATIC_LISTENEDCH , strLab[2]);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -