// ShowString.cpp : implementation file // #include "stdafx.h" #include "StoneU_HC_OCX.h" #include "ShowString.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CShowString dialog CShowString::CShowString(CWnd* pParent /*=NULL*/) : CDialog(CShowString::IDD, pParent) { //{{AFX_DATA_INIT(CShowString) m_string = _T(""); m_chkshow = FALSE; m_stringX = 0; m_stringY = 0; //}}AFX_DATA_INIT } void CShowString::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CShowString) DDX_Control(pDX, IDC_COMAREA, m_areaCtrl); DDX_Text(pDX, IDC_EDITSTRING, m_string); DDX_Check(pDX, IDC_CHKSHOW, m_chkshow); DDX_Text(pDX, IDC_STRING_X, m_stringX); DDX_Text(pDX, IDC_STRING_Y, m_stringY); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CShowString, CDialog) //{{AFX_MSG_MAP(CShowString) ON_BN_CLICKED(IDC_BUTOK, OnButok) ON_BN_CLICKED(IDC_BUTEXIT, OnButexit) ON_BN_CLICKED(IDC_BUTOK2, OnButok2) ON_CBN_SELCHANGE(IDC_COMAREA, OnSelchangeComarea) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CShowString message handlers BOOL CShowString::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here m_areaCtrl.SetCurSel(0); if (!NET_DVR_GetDVRConfig(m_lServerID, NET_DVR_GET_SHOWSTRING, m_nChanNum, &m_ShowString, sizeof(NET_DVR_SHOWSTRING), &dwReturned)) { CString sTemp; sTemp.Format("ERROR: NET_DVR_GET_SHOWSTRING = %d \n", NET_DVR_GetLastError()); TRACE(sTemp); MessageBox(sTemp, "ΞΒά°ΜαΚΎ", MB_ICONINFORMATION); return FALSE; } else { m_chkshow = m_ShowString.struStringInfo[0].wShowString; m_string.Format("%s", m_ShowString.struStringInfo[0].sString); m_stringX = m_ShowString.struStringInfo[0].wShowStringTopLeftX; m_stringY = m_ShowString.struStringInfo[0].wShowStringTopLeftY; } UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CShowString::OnCancel() { // TODO: Add extra cleanup here // CDialog::OnCancel(); } void CShowString::OnOK() { // TODO: Add extra validation here // CDialog::OnOK(); } void CShowString::OnButok() { // TODO: Add your control notification handler code here UpdateData(TRUE); UpdateData(TRUE); int i = m_areaCtrl.GetCurSel(); m_ShowString.struStringInfo[i].wShowString = m_chkshow; memcpy(m_ShowString.struStringInfo[i].sString, m_string, 44); m_ShowString.struStringInfo[i].wStringSize = strlen(m_string); m_ShowString.struStringInfo[i].wShowStringTopLeftX = m_stringX; m_ShowString.struStringInfo[i].wShowStringTopLeftY = m_stringY; if (!NET_DVR_SetDVRConfig(m_lServerID, NET_DVR_SET_SHOWSTRING, m_nChanNum, &m_ShowString, sizeof(NET_DVR_SHOWSTRING))) { CString sTemp; sTemp.Format("ERROR: NET_DVR_SET_SHOWSTRING = %d \n", NET_DVR_GetLastError()); TRACE(sTemp); MessageBox(sTemp, "ΞΒά°ΜαΚΎ", MB_ICONINFORMATION); return ; } } void CShowString::OnButexit() { // TODO: Add your control notification handler code here CDialog::OnOK(); } void CShowString::OnButok2() { // TODO: Add your control notification handler code here UpdateData(TRUE); int i = m_areaCtrl.GetCurSel(); m_ShowString.struStringInfo[i].wShowString = m_chkshow; memcpy(m_ShowString.struStringInfo[i].sString, m_string, 44); m_ShowString.struStringInfo[i].wStringSize = strlen(m_string); m_ShowString.struStringInfo[i].wShowStringTopLeftX = m_stringX; m_ShowString.struStringInfo[i].wShowStringTopLeftY = m_stringY; } void CShowString::OnSelchangeComarea() { // TODO: Add your control notification handler code here int i = m_areaCtrl.GetCurSel(); m_chkshow = m_ShowString.struStringInfo[i].wShowString; m_string.Format("%s", m_ShowString.struStringInfo[i].sString); m_stringX = m_ShowString.struStringInfo[i].wShowStringTopLeftX; m_stringY = m_ShowString.struStringInfo[i].wShowStringTopLeftY; UpdateData(FALSE); }