matdynamictest.cpp

来自「SDK DVR/DVS HIKVISION」· C++ 代码 · 共 115 行

CPP
115
字号
// MatDynamicTest.cpp : implementation file
//

#include "stdafx.h"
#include "newclient.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("success!");
}

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("success!");
}

BOOL CMatDynamicTest::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here
	CString tmp;
	for (int i=0; i<m_iChannelnumber;i++)
	{
		tmp.Format("%d", i + m_lStartChan);
		m_DecChanCombo.AddString(tmp);
	}
	m_DecChanCombo.SetCurSel(0);
	m_TransProtocolCombo.SetCurSel(0);
	m_TransModeCombo.SetCurSel(0);

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

⌨️ 快捷键说明

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