MatDynamicTest.cpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. // MatDynamicTest.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "StoneU_HC_OCX.h"
  5. #include "MatDynamicTest.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CMatDynamicTest dialog
  13. CMatDynamicTest::CMatDynamicTest(CWnd* pParent /*=NULL*/)
  14. : CDialog(CMatDynamicTest::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CMatDynamicTest)
  17. m_RemoteIP = _T("");
  18. m_RemotePort = 0;
  19. m_RemoteSurveillace = 0;
  20. m_RemoteUser = _T("");
  21. m_RemotePass = _T("");
  22. //}}AFX_DATA_INIT
  23. }
  24. void CMatDynamicTest::DoDataExchange(CDataExchange* pDX)
  25. {
  26. CDialog::DoDataExchange(pDX);
  27. //{{AFX_DATA_MAP(CMatDynamicTest)
  28. DDX_Control(pDX, IDC_COMBODECCHANNUM, m_DecChanCombo);
  29. DDX_Control(pDX, IDC_COMBOTRANSMODE, m_TransModeCombo);
  30. DDX_Control(pDX, IDC_COMBOPROTOCOL, m_TransProtocolCombo);
  31. DDX_Text(pDX, IDC_EDITREMOTEIP, m_RemoteIP);
  32. DDX_Text(pDX, IDC_EDITREMOTEPORT, m_RemotePort);
  33. DDX_Text(pDX, IDC_EDITREMOTESURVE, m_RemoteSurveillace);
  34. DDX_Text(pDX, IDC_EDITREMOTENAME, m_RemoteUser);
  35. DDX_Text(pDX, IDC_EDITREMOTEPASS, m_RemotePass);
  36. //}}AFX_DATA_MAP
  37. }
  38. BEGIN_MESSAGE_MAP(CMatDynamicTest, CDialog)
  39. //{{AFX_MSG_MAP(CMatDynamicTest)
  40. ON_BN_CLICKED(IDC_STARTDYNAMIC, OnStartdynamic)
  41. ON_BN_CLICKED(IDC_STOPDYNAMIC, OnStopdynamic)
  42. //}}AFX_MSG_MAP
  43. END_MESSAGE_MAP()
  44. /////////////////////////////////////////////////////////////////////////////
  45. // CMatDynamicTest message handlers
  46. void CMatDynamicTest::OnStartdynamic()
  47. {
  48. // TODO: Add your control notification handler code here
  49. UpdateData(TRUE);
  50. NET_DVR_MATRIX_DYNAMIC_DEC dt;
  51. ZeroMemory(&dt, sizeof(dt));
  52. dt.dwSize = sizeof(NET_DVR_MATRIX_DYNAMIC_DEC);
  53. dt.struDecChanInfo.byChannel = (BYTE)m_RemoteSurveillace;
  54. dt.struDecChanInfo.byTransMode = m_TransModeCombo.GetCurSel();
  55. dt.struDecChanInfo.byTransProtocol = m_TransProtocolCombo.GetCurSel();
  56. sprintf((char *)dt.struDecChanInfo.sPassword, "%s", m_RemotePass);
  57. sprintf((char *)dt.struDecChanInfo.sUserName, "%s", m_RemoteUser);
  58. sprintf(dt.struDecChanInfo.sDVRIP, "%s", m_RemoteIP);
  59. dt.struDecChanInfo.wDVRPort = m_RemotePort;
  60. if (!NET_DVR_MatrixStartDynamic(m_lServerID, m_DecChanCombo.GetCurSel()+m_lStartChan, &dt))
  61. {
  62. CString tmp;
  63. tmp.Format("Error: NET_DVR_MatrixStartDynamic = %d\n", NET_DVR_GetLastError());
  64. AfxMessageBox(tmp);
  65. return;
  66. }
  67. MessageBox("³É¹¦Æô¶¯!");
  68. }
  69. void CMatDynamicTest::OnStopdynamic()
  70. {
  71. // TODO: Add your control notification handler code here
  72. UpdateData(TRUE);
  73. if (!NET_DVR_MatrixStopDynamic(m_lServerID, m_DecChanCombo.GetCurSel()+m_lStartChan))
  74. {
  75. TRACE("\nError: NET_DVR_MatrixStopDynamic = %d\n", NET_DVR_GetLastError());
  76. return;
  77. }
  78. MessageBox("³É¹¦Í£Ö¹!");
  79. }
  80. BOOL CMatDynamicTest::OnInitDialog()
  81. {
  82. CDialog::OnInitDialog();
  83. // TODO: Add extra initialization here
  84. CString tmp;
  85. for (int i=0; i<m_iChannelnumber;i++)
  86. {
  87. tmp.Format("%d", i + m_lStartChan);
  88. m_DecChanCombo.AddString(tmp);
  89. }
  90. m_DecChanCombo.SetCurSel(0);
  91. m_TransProtocolCombo.SetCurSel(0);
  92. m_TransModeCombo.SetCurSel(0);
  93. UpdateData(FALSE);
  94. return TRUE; // return TRUE unless you set the focus to a control
  95. // EXCEPTION: OCX Property Pages should return FALSE
  96. }