// SettingsDlg.cpp : implementation file // #include "stdafx.h" #include "HKVision.h" #include "SettingsDlg.h" #include "hikvisionsdk.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif extern int g_nTotalChannel; ///////////////////////////////////////////////////////////////////////////// // CSettingsDlg dialog extern HANDLE ChannelHandle[MAX_CHANNELS]; CSettingsDlg::CSettingsDlg(CWnd* pParent /*=NULL*/) : CDialog(CSettingsDlg::IDD, pParent) { //{{AFX_DATA_INIT(CSettingsDlg) m_Quant = 18; m_FileSize = 100; m_StreamType = 2; m_FrameMode = 3; m_IFramesIntervals = 100; m_iQuant = 15; m_pQuant = 15; m_bQuant = 20; m_OsdEnable = TRUE; m_logoEnable = TRUE; m_FrameRate = 25; m_MotionDetect = FALSE; m_dwbitrate = 4000000; m_bCbr = FALSE; m_iEncodeType = 3; //}}AFX_DATA_INIT } void CSettingsDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CSettingsDlg) DDX_Control(pDX, IDC_SER_LIST, m_BoardList); DDX_Text(pDX, IDC_FILE_SIZE, m_FileSize); DDX_Radio(pDX, IDC_VIDEO, m_StreamType); DDX_Text(pDX, IDC_IFRAME_INTERVALS, m_IFramesIntervals); DDX_Text(pDX, IDC_IQUANT, m_iQuant); DDV_MinMaxInt(pDX, m_iQuant, 3, 30); DDX_Text(pDX, IDC_PQUANT, m_pQuant); DDV_MinMaxInt(pDX, m_pQuant, 3, 30); DDX_Text(pDX, IDC_BQUANT, m_bQuant); DDV_MinMaxInt(pDX, m_bQuant, 3, 30); DDX_Check(pDX, IDC_OSD_ENABLE, m_OsdEnable); DDX_Check(pDX, IDC_LOGO, m_logoEnable); DDX_Text(pDX, IDC_FRAME_RATE, m_FrameRate); DDV_MinMaxInt(pDX, m_FrameRate, 1, 25); DDX_Check(pDX, IDC_MOTION_DETECT, m_MotionDetect); DDX_Text(pDX, IDC_MAX_BPS,m_dwbitrate); DDX_Check(pDX, IDC_CHECK1, m_bCbr); DDX_Radio(pDX, IDC_RADIO5, m_iEncodeType); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CSettingsDlg, CDialog) //{{AFX_MSG_MAP(CSettingsDlg) ON_BN_CLICKED(IDC_CHECK1, OnCheck1) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CSettingsDlg message handlers void CSettingsDlg::OnOK() { // TODO: Add extra validation here UpdateData(TRUE); CDialog::OnOK(); } BOOL CSettingsDlg::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here ULONG boardType; UCHAR serialNo[20]; char strSerialNo[20]; CString serlist; CString serList2; for(int i = 0; i < g_nTotalChannel; i++){ GetBoardInfo(ChannelHandle[i], &boardType, serialNo); // convert to string for( int j = 0; j < 12; j ++) strSerialNo[j] = serialNo[j] + 0x30; // append null to the string strSerialNo[j] = NULL; TRACE("serailNo = %s\n", strSerialNo); serlist.Format("serialNo = %s\r\n" , strSerialNo); int len = m_BoardList.GetWindowTextLength(); m_BoardList.SetSel(len, len); m_BoardList.ReplaceSel(serlist); } return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CSettingsDlg::OnCheck1() { // TODO: Add your control notification handler code here if(((CButton *)GetDlgItem(IDC_CHECK1))->GetState() & 1) GetDlgItem(IDC_MAX_BPS)->EnableWindow(TRUE); else GetDlgItem(IDC_MAX_BPS)->EnableWindow(FALSE); }