// MatDynamicTest.cpp : implementation file // #include "stdafx.h" #include "StoneU_HC_OCX.h" #include "MatDynamicTest.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CMatDynamicTest dialog CMatDynamicTest::CMatDynamicTest(CWnd* pParent /*=NULL*/) : CDialog(CMatDynamicTest::IDD, pParent) { //{{AFX_DATA_INIT(CMatDynamicTest) m_RemoteIP = _T(""); m_RemotePort = 0; m_RemoteSurveillace = 0; m_RemoteUser = _T(""); m_RemotePass = _T(""); //}}AFX_DATA_INIT } void CMatDynamicTest::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CMatDynamicTest) DDX_Control(pDX, IDC_COMBODECCHANNUM, m_DecChanCombo); DDX_Control(pDX, IDC_COMBOTRANSMODE, m_TransModeCombo); DDX_Control(pDX, IDC_COMBOPROTOCOL, m_TransProtocolCombo); DDX_Text(pDX, IDC_EDITREMOTEIP, m_RemoteIP); DDX_Text(pDX, IDC_EDITREMOTEPORT, m_RemotePort); DDX_Text(pDX, IDC_EDITREMOTESURVE, m_RemoteSurveillace); DDX_Text(pDX, IDC_EDITREMOTENAME, m_RemoteUser); DDX_Text(pDX, IDC_EDITREMOTEPASS, m_RemotePass); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CMatDynamicTest, CDialog) //{{AFX_MSG_MAP(CMatDynamicTest) ON_BN_CLICKED(IDC_STARTDYNAMIC, OnStartdynamic) ON_BN_CLICKED(IDC_STOPDYNAMIC, OnStopdynamic) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CMatDynamicTest message handlers void CMatDynamicTest::OnStartdynamic() { // TODO: Add your control notification handler code here UpdateData(TRUE); NET_DVR_MATRIX_DYNAMIC_DEC dt; ZeroMemory(&dt, sizeof(dt)); dt.dwSize = sizeof(NET_DVR_MATRIX_DYNAMIC_DEC); dt.struDecChanInfo.byChannel = (BYTE)m_RemoteSurveillace; dt.struDecChanInfo.byTransMode = m_TransModeCombo.GetCurSel(); dt.struDecChanInfo.byTransProtocol = m_TransProtocolCombo.GetCurSel(); sprintf((char *)dt.struDecChanInfo.sPassword, "%s", m_RemotePass); sprintf((char *)dt.struDecChanInfo.sUserName, "%s", m_RemoteUser); sprintf(dt.struDecChanInfo.sDVRIP, "%s", m_RemoteIP); dt.struDecChanInfo.wDVRPort = m_RemotePort; if (!NET_DVR_MatrixStartDynamic(m_lServerID, m_DecChanCombo.GetCurSel()+m_lStartChan, &dt)) { CString tmp; tmp.Format("Error: NET_DVR_MatrixStartDynamic = %d\n", NET_DVR_GetLastError()); AfxMessageBox(tmp); return; } MessageBox("成功启动!"); } void CMatDynamicTest::OnStopdynamic() { // TODO: Add your control notification handler code here UpdateData(TRUE); if (!NET_DVR_MatrixStopDynamic(m_lServerID, m_DecChanCombo.GetCurSel()+m_lStartChan)) { TRACE("\nError: NET_DVR_MatrixStopDynamic = %d\n", NET_DVR_GetLastError()); return; } MessageBox("成功停止!"); } BOOL CMatDynamicTest::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CString tmp; for (int i=0; i