📄 exceptioncfg.cpp
字号:
// ExceptionCFG.cpp : implementation file
//
#include "stdafx.h"
#include "newclient.h"
#include "ExceptionCFG.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExceptionCFG dialog
CExceptionCFG::CExceptionCFG(CWnd* pParent /*=NULL*/)
: CDialog(CExceptionCFG::IDD, pParent)
{
//{{AFX_DATA_INIT(CExceptionCFG)
m_bHandleType1 = FALSE;
m_bHandleType2 = FALSE;
m_bHandleType3 = FALSE;
m_bHandleType4 = FALSE;
m_bAlarmOut1 = FALSE;
m_bAlarmOut2 = FALSE;
m_bAlarmOut3 = FALSE;
m_bAlarmOut4 = FALSE;
//}}AFX_DATA_INIT
}
void CExceptionCFG::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CExceptionCFG)
DDX_Control(pDX, IDC_COMBOEXCEPTION, m_ExceptionCtrl);
DDX_Check(pDX, IDC_CHKHANDLE1, m_bHandleType1);
DDX_Check(pDX, IDC_CHKHANDLE2, m_bHandleType2);
DDX_Check(pDX, IDC_CHKHANDLE3, m_bHandleType3);
DDX_Check(pDX, IDC_CHKHANDLE4, m_bHandleType4);
DDX_Check(pDX, IDC_CHKALARMOUT1, m_bAlarmOut1);
DDX_Check(pDX, IDC_CHKALARMOUT2, m_bAlarmOut2);
DDX_Check(pDX, IDC_CHKALARMOUT3, m_bAlarmOut3);
DDX_Check(pDX, IDC_CHKALARMOUT4, m_bAlarmOut4);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CExceptionCFG, CDialog)
//{{AFX_MSG_MAP(CExceptionCFG)
ON_BN_CLICKED(IDC_CHKALARMOUT4, OnChkalarmout4)
ON_CBN_SELCHANGE(IDC_COMBOEXCEPTION, OnSelchangeComboexception)
ON_BN_CLICKED(IDC_BUTEXIT, OnButexit)
ON_BN_CLICKED(IDC_BUTOK, OnButok)
ON_BN_CLICKED(IDC_CHKHANDLE4, OnChkhandle4)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CExceptionCFG message handlers
BOOL CExceptionCFG::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CRect rc(0, 0, 0, 0);
GetParent()->GetClientRect(&rc);
((CTabCtrl*)GetParent())->AdjustRect(FALSE, &rc);
MoveWindow(&rc);
DWORD dwReturned;
CString sTemp;
m_SelType = 0;
m_ExceptionCtrl.SetCurSel(m_SelType);
if (m_bConnectServer)
{
if (!NET_DVR_GetDVRConfig(m_lServerID, NET_DVR_GET_EXCEPTIONCFG, 0,&m_ExceptionInfo, sizeof(NET_DVR_EXCEPTION), &dwReturned))
{
sTemp.Format("ERROR: NET_DVR_GET_EXCEPTIONCFG = %d \n", NET_DVR_GetLastError());
AfxMessageBox(sTemp);
}
else
{
m_bHandleType1 = m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType &0x01;
m_bHandleType2 = (m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType>>1)&0x01;
m_bHandleType3 = (m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType>>2)&0x01;
m_bHandleType4 = (m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType>>3)&0x01;
EnableControl(m_bHandleType4);
}
}
UpdateData(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CExceptionCFG::OnOK()
{
// TODO: Add extra validation here
// CDialog::OnOK();
}
void CExceptionCFG::OnCancel()
{
// TODO: Add extra cleanup here
// CDialog::OnCancel();
}
void CExceptionCFG::OnChkalarmout4()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
EnableControl(m_bHandleType4);
}
void CExceptionCFG::OnSelchangeComboexception()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_SelType = m_ExceptionCtrl.GetCurSel();
m_bHandleType1 = m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType &0x01;
m_bHandleType2 = (m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType>>1)&0x01;
m_bHandleType3 = (m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType>>2)&0x01;
m_bHandleType4 = (m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType>>3)&0x01;
EnableControl(m_bHandleType4);
UpdateData(FALSE);
}
void CExceptionCFG::EnableControl(BOOL bEnable)
{
if (m_dwAlarmOutNum >= 1)
{
GetDlgItem(IDC_CHKALARMOUT1)->EnableWindow(bEnable);
m_bAlarmOut1 = m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[0];
}
if (m_dwAlarmOutNum >= 2)
{
GetDlgItem(IDC_CHKALARMOUT2)->EnableWindow(bEnable);
m_bAlarmOut2 = m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[1];
}
if (m_dwAlarmOutNum >= 3)
{
GetDlgItem(IDC_CHKALARMOUT3)->EnableWindow(bEnable);
m_bAlarmOut3 = m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[2];
}
if (m_dwAlarmOutNum >= 4)
{
GetDlgItem(IDC_CHKALARMOUT4)->EnableWindow(bEnable);
m_bAlarmOut4 = m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[3];
}
}
void CExceptionCFG::OnButexit()
{
// TODO: Add your control notification handler code here
m_bSetPara = FALSE;
}
void CExceptionCFG::OnButok()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_SelType = m_ExceptionCtrl.GetCurSel();
m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType = 0;
m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType |= (m_bHandleType1 << 0);
m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType |= (m_bHandleType2 << 1);
m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType |= (m_bHandleType3 << 2);
m_ExceptionInfo.struExceptionHandleType[m_SelType].dwHandleType |= (m_bHandleType4 << 3);
m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[0] = m_bAlarmOut1;
m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[1] = m_bAlarmOut2;
m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[2] = m_bAlarmOut3;
m_ExceptionInfo.struExceptionHandleType[m_SelType].byRelAlarmOut[3] = m_bAlarmOut4;
m_bSetPara = TRUE;
}
void CExceptionCFG::OnChkhandle4()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
EnableControl(m_bHandleType4);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -