ShowString.cpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. // ShowString.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "StoneU_HC_OCX.h"
  5. #include "ShowString.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CShowString dialog
  13. CShowString::CShowString(CWnd* pParent /*=NULL*/)
  14. : CDialog(CShowString::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CShowString)
  17. m_string = _T("");
  18. m_chkshow = FALSE;
  19. m_stringX = 0;
  20. m_stringY = 0;
  21. //}}AFX_DATA_INIT
  22. }
  23. void CShowString::DoDataExchange(CDataExchange* pDX)
  24. {
  25. CDialog::DoDataExchange(pDX);
  26. //{{AFX_DATA_MAP(CShowString)
  27. DDX_Control(pDX, IDC_COMAREA, m_areaCtrl);
  28. DDX_Text(pDX, IDC_EDITSTRING, m_string);
  29. DDX_Check(pDX, IDC_CHKSHOW, m_chkshow);
  30. DDX_Text(pDX, IDC_STRING_X, m_stringX);
  31. DDX_Text(pDX, IDC_STRING_Y, m_stringY);
  32. //}}AFX_DATA_MAP
  33. }
  34. BEGIN_MESSAGE_MAP(CShowString, CDialog)
  35. //{{AFX_MSG_MAP(CShowString)
  36. ON_BN_CLICKED(IDC_BUTOK, OnButok)
  37. ON_BN_CLICKED(IDC_BUTEXIT, OnButexit)
  38. ON_BN_CLICKED(IDC_BUTOK2, OnButok2)
  39. ON_CBN_SELCHANGE(IDC_COMAREA, OnSelchangeComarea)
  40. //}}AFX_MSG_MAP
  41. END_MESSAGE_MAP()
  42. /////////////////////////////////////////////////////////////////////////////
  43. // CShowString message handlers
  44. BOOL CShowString::OnInitDialog()
  45. {
  46. CDialog::OnInitDialog();
  47. // TODO: Add extra initialization here
  48. m_areaCtrl.SetCurSel(0);
  49. if (!NET_DVR_GetDVRConfig(m_lServerID, NET_DVR_GET_SHOWSTRING, m_nChanNum, &m_ShowString, sizeof(NET_DVR_SHOWSTRING), &dwReturned))
  50. {
  51. CString sTemp;
  52. sTemp.Format("ERROR: NET_DVR_GET_SHOWSTRING = %d \n", NET_DVR_GetLastError());
  53. TRACE(sTemp);
  54. MessageBox(sTemp, "ÎÂܰÌáʾ", MB_ICONINFORMATION);
  55. return FALSE;
  56. }
  57. else
  58. {
  59. m_chkshow = m_ShowString.struStringInfo[0].wShowString;
  60. m_string.Format("%s", m_ShowString.struStringInfo[0].sString);
  61. m_stringX = m_ShowString.struStringInfo[0].wShowStringTopLeftX;
  62. m_stringY = m_ShowString.struStringInfo[0].wShowStringTopLeftY;
  63. }
  64. UpdateData(FALSE);
  65. return TRUE; // return TRUE unless you set the focus to a control
  66. // EXCEPTION: OCX Property Pages should return FALSE
  67. }
  68. void CShowString::OnCancel()
  69. {
  70. // TODO: Add extra cleanup here
  71. // CDialog::OnCancel();
  72. }
  73. void CShowString::OnOK()
  74. {
  75. // TODO: Add extra validation here
  76. // CDialog::OnOK();
  77. }
  78. void CShowString::OnButok()
  79. {
  80. // TODO: Add your control notification handler code here
  81. UpdateData(TRUE);
  82. UpdateData(TRUE);
  83. int i = m_areaCtrl.GetCurSel();
  84. m_ShowString.struStringInfo[i].wShowString = m_chkshow;
  85. memcpy(m_ShowString.struStringInfo[i].sString, m_string, 44);
  86. m_ShowString.struStringInfo[i].wStringSize = strlen(m_string);
  87. m_ShowString.struStringInfo[i].wShowStringTopLeftX = m_stringX;
  88. m_ShowString.struStringInfo[i].wShowStringTopLeftY = m_stringY;
  89. if (!NET_DVR_SetDVRConfig(m_lServerID, NET_DVR_SET_SHOWSTRING, m_nChanNum, &m_ShowString, sizeof(NET_DVR_SHOWSTRING)))
  90. {
  91. CString sTemp;
  92. sTemp.Format("ERROR: NET_DVR_SET_SHOWSTRING = %d \n", NET_DVR_GetLastError());
  93. TRACE(sTemp);
  94. MessageBox(sTemp, "ÎÂܰÌáʾ", MB_ICONINFORMATION);
  95. return ;
  96. }
  97. }
  98. void CShowString::OnButexit()
  99. {
  100. // TODO: Add your control notification handler code here
  101. CDialog::OnOK();
  102. }
  103. void CShowString::OnButok2()
  104. {
  105. // TODO: Add your control notification handler code here
  106. UpdateData(TRUE);
  107. int i = m_areaCtrl.GetCurSel();
  108. m_ShowString.struStringInfo[i].wShowString = m_chkshow;
  109. memcpy(m_ShowString.struStringInfo[i].sString, m_string, 44);
  110. m_ShowString.struStringInfo[i].wStringSize = strlen(m_string);
  111. m_ShowString.struStringInfo[i].wShowStringTopLeftX = m_stringX;
  112. m_ShowString.struStringInfo[i].wShowStringTopLeftY = m_stringY;
  113. }
  114. void CShowString::OnSelchangeComarea()
  115. {
  116. // TODO: Add your control notification handler code here
  117. int i = m_areaCtrl.GetCurSel();
  118. m_chkshow = m_ShowString.struStringInfo[i].wShowString;
  119. m_string.Format("%s", m_ShowString.struStringInfo[i].sString);
  120. m_stringX = m_ShowString.struStringInfo[i].wShowStringTopLeftX;
  121. m_stringY = m_ShowString.struStringInfo[i].wShowStringTopLeftY;
  122. UpdateData(FALSE);
  123. }