⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setrecagc.cpp

📁 三汇CTI示例程序源码
💻 CPP
字号:

// SetRecAGC.cpp : implementation file
//

#include "stdafx.h"
#include "Record.h"
#include "SetRecAGC.h"
//#include "Language.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CSetRecAGC dialog


CSetRecAGC::CSetRecAGC(CWnd* pParent /*=NULL*/)
	: CDialog(CSetRecAGC::IDD, pParent)
{
	//{{AFX_DATA_INIT(CSetRecAGC)
	//}}AFX_DATA_INIT
}


void CSetRecAGC::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CSetRecAGC)
	DDX_Control(pDX, IDC_COMBO_AGC, m_cmbSetRecAGC);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CSetRecAGC, CDialog)
	//{{AFX_MSG_MAP(CSetRecAGC)
	ON_BN_CLICKED(IDC_BUTTON_OPENAGC, OnButtonOpenagc)
	ON_BN_CLICKED(IDC_BUTTON_CLOSEAGC, OnButtonCloseagc)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CSetRecAGC message handlers

BOOL CSetRecAGC::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here

	char szTmp[10];
	int nMaxCh;

	nMaxCh = SsmGetMaxCh();	  //retrieve channel amounts declared in configuratin file 
	if(nMaxCh == -1)
	{
		WriteLog("failed to call function SsmGetMaxCh()");
	}

	for(int ch=0, i=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 no module is installed on stated channel 
		{							  
			m_cmbSetRecAGC.InsertString(i++, _itoa(ch, szTmp, 10));
		}
	}

	m_cmbSetRecAGC.SetCurSel(0);

	InitLab();

	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}


void CSetRecAGC::OnButtonOpenagc()  //enable AGC 
{
	// TODO: Add your control notification handler code here
	int nCurLine;
	char szErrMsg[200];
	char sz[10];

	memset(sz, 0, sizeof(char)*10);
	m_cmbSetRecAGC.GetLBText(m_cmbSetRecAGC.GetCurSel(), sz);
	nCurLine = atoi(sz);

	if(SsmSetRecAGC(nCurLine, 1) == -1)  //enable AGC
	{
		SsmGetLastErrMsg(szErrMsg);  //retrive error message 
		AfxMessageBox(szErrMsg, MB_OK, 0);
	}
}


void CSetRecAGC::OnButtonCloseagc()  //disable AGC
{
	// TODO: Add your control notification handler code here
	int nCurLine;
	char szErrMsg[200];
	char sz[10];

	memset(sz, 0, sizeof(char)*10);
	m_cmbSetRecAGC.GetLBText(m_cmbSetRecAGC.GetCurSel(), sz);
	nCurLine = atoi(sz);

	if(SsmSetRecAGC(nCurLine, 0) == -1)	//disable AGC
	{
		SsmGetLastErrMsg(szErrMsg);   //retrieve error message 
		AfxMessageBox(szErrMsg, MB_OK, 0);
	}
}


void CSetRecAGC::InitLab()
{	
	if(g_dwLanguageConversion == g_dwCHINESE_SIMPLIFIED)
	{
		//Chinese
		strLab[0].Format("设置AGC");
		strLab[1].Format("通道");		
	}
	else
	{	//English
		strLab[0].Format("SetAGC");
		strLab[1].Format("ChannelId");
	}
	SetWinTextLab(this, IDC_STATIC_AGC,		strLab[0]);
	SetWinTextLab(this, IDC_STATIC_AGCCH,	strLab[1]);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -