// MatCycLink.cpp : implementation file // #include "stdafx.h" #include "StoneU_HC_OCX.h" #include "MatCycLink.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMatCycLink dialog CMatCycLink::CMatCycLink(CWnd* pParent /*=NULL*/) : CDialog(CMatCycLink::IDD, pParent) { //{{AFX_DATA_INIT(CMatCycLink) m_DVRChannel = 0; m_DVRIP = _T(""); m_DVRPasswd = _T(""); m_DVRPort = 0; m_DVRUser = _T(""); m_PoolTime = 0; m_bCheckConnectChan = FALSE; //}}AFX_DATA_INIT m_iChanSel = -1; for (int i=0; iEnableWindow(bEnable); GetDlgItem(IDC_EDITDVRPORT)->EnableWindow(bEnable); GetDlgItem(IDC_EDITDVRCHAN)->EnableWindow(bEnable); GetDlgItem(IDC_EDITDVRUSER)->EnableWindow(bEnable); GetDlgItem(IDC_EDITDVRPASSWD)->EnableWindow(bEnable); GetDlgItem(IDC_COMBOTRANSMODE)->EnableWindow(bEnable); GetDlgItem(IDC_COMBOTRANSTYPE)->EnableWindow(bEnable); UpdateData(FALSE); } void CMatCycLink::OnSelchangeCombodecchan() { // TODO: Add your control notification handler code here int sel = m_DecChanCombo.GetCurSel(); if (sel == m_iChanSel) { return; } m_iChanSel = sel; m_PoolTime = m_MatLoopDec[m_iChanSel].dwPoolTime; m_ConnectChanCombo.SetCurSel(0); m_bCheckConnectChan = m_MatLoopDec[m_iChanSel].struchanConInfo[0].dwEnable; if (m_MatLoopDec[m_iChanSel].struchanConInfo[0].dwEnable) { EnableConChan(TRUE); m_DVRIP.Format("%s", m_MatLoopDec[m_iChanSel].struchanConInfo[0].struDecChanInfo.sDVRIP); m_DVRPort = m_MatLoopDec[m_iChanSel].struchanConInfo[0].struDecChanInfo.wDVRPort; m_DVRUser.Format("%s", m_MatLoopDec[m_iChanSel].struchanConInfo[0].struDecChanInfo.sUserName); m_DVRPasswd.Format("%s", m_MatLoopDec[m_iChanSel].struchanConInfo[0].struDecChanInfo.sPassword); m_DVRChannel = m_MatLoopDec[m_iChanSel].struchanConInfo[0].struDecChanInfo.byChannel; m_TransModesCombo.SetCurSel(m_MatLoopDec[m_iChanSel].struchanConInfo[0].struDecChanInfo.byTransMode); m_TransProtocolCombo.SetCurSel(m_MatLoopDec[m_iChanSel].struchanConInfo[0].struDecChanInfo.byTransProtocol); } else { EnableConChan(FALSE); } UpdateData(FALSE); } void CMatCycLink::OnSelchangeComboconchan() { // TODO: Add your control notification handler code here int sel = m_ConnectChanCombo.GetCurSel(); m_bCheckConnectChan = m_MatLoopDec[m_iChanSel].struchanConInfo[sel].dwEnable; TRACE("\n### m_bCheckConnectChan = 0x%x\n", m_bCheckConnectChan); if (m_MatLoopDec[m_iChanSel].struchanConInfo[sel].dwEnable) { EnableConChan(TRUE); m_DVRIP.Format("%s", m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.sDVRIP); m_DVRPort = m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.wDVRPort; m_DVRUser.Format("%s", m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.sUserName); m_DVRPasswd.Format("%s", m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.sPassword); m_DVRChannel = m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.byChannel; m_TransModesCombo.SetCurSel(m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.byTransMode); m_TransProtocolCombo.SetCurSel(m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.byTransProtocol); } else { EnableConChan(FALSE); } UpdateData(FALSE); } void CMatCycLink::OnSavepara() { // TODO: Add your control notification handler code here UpdateData(TRUE); int sel = m_ConnectChanCombo.GetCurSel(); ZeroMemory(&m_MatLoopDec[m_iChanSel].struchanConInfo[sel], sizeof(m_MatLoopDec[m_iChanSel].struchanConInfo[sel])); m_MatLoopDec[m_iChanSel].struchanConInfo[sel].dwEnable = m_bCheckConnectChan; if (m_bCheckConnectChan) { m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.byChannel = m_DVRChannel; m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.byTransMode = m_TransModesCombo.GetCurSel(); m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.byTransProtocol = m_TransProtocolCombo.GetCurSel(); m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.wDVRPort = m_DVRPort; sprintf(m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.sDVRIP, "%s", m_DVRIP); sprintf((char *)m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.sUserName, "%s", m_DVRUser); sprintf((char *)m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.sPassword, "%s", m_DVRPasswd); } } void CMatCycLink::OnSetparam() { // TODO: Add your control notification handler code here UpdateData(TRUE); int sel = m_ConnectChanCombo.GetCurSel(); ZeroMemory(&m_MatLoopDec[m_iChanSel].struchanConInfo[sel], sizeof(m_MatLoopDec[m_iChanSel].struchanConInfo[sel])); m_MatLoopDec[m_iChanSel].struchanConInfo[sel].dwEnable = m_bCheckConnectChan; if (m_bCheckConnectChan) { m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.byChannel = m_DVRChannel; m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.byTransMode = m_TransModesCombo.GetCurSel(); m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.byTransProtocol = m_TransProtocolCombo.GetCurSel(); m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.wDVRPort = m_DVRPort; sprintf(m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.sDVRIP, "%s", m_DVRIP); sprintf((char *)m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.sUserName, "%s", m_DVRUser); sprintf((char *)m_MatLoopDec[m_iChanSel].struchanConInfo[sel].struDecChanInfo.sPassword, "%s", m_DVRPasswd); } m_MatLoopDec[m_iChanSel].dwPoolTime = m_PoolTime; BOOL error = FALSE; for (int i=0; i>1; TRACE("\n### %d\n", m_CycLink[i]); } m_SwitchCombo.SetCurSel(m_CycLink[sel]); UpdateData(FALSE); MessageBox("获取成功!"); } void CMatCycLink::OnSingleset() { // TODO: Add your control notification handler code here UpdateData(TRUE); int sel = m_DecChanCombo2.GetCurSel(); BOOL flg = FALSE; if (m_SwitchCombo.GetCurSel()) { flg = TRUE; } if (!NET_DVR_MatrixSetLoopDecChanEnable(m_lServerID, sel+m_lStartChan, flg)) { TRACE("\nError: NET_DVR_MatrixSetLoopDecChanEnable[%d] = %d\n", sel+m_lStartChan, NET_DVR_GetLastError()); return; } MessageBox("设置成功!"); } void CMatCycLink::OnCheckconchan() { // TODO: Add your control notification handler code here UpdateData(TRUE); EnableConChan(m_bCheckConnectChan); } void CMatCycLink::OnSelchangeCombodecchan2() { // TODO: Add your control notification handler code here int sel = m_DecChanCombo2.GetCurSel(); m_SwitchCombo.SetCurSel(m_CycLink[sel]); UpdateData(FALSE); }