// RemoteTimePlay.cpp : implementation file // #include "stdafx.h" #include "newclient.h" #include "RemoteTimePlay.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CRemoteTimePlay dialog extern SERVER_INFO serverinfo[MAXIPNUMBER]; extern CLIENTPARAM ClientParam; CRemoteTimePlay::CRemoteTimePlay(CWnd* pParent /*=NULL*/) : CDialog(CRemoteTimePlay::IDD, pParent) { //{{AFX_DATA_INIT(CRemoteTimePlay) m_ctDateStart = 0; m_ctDateStop = 0; m_ctTimeStart = 0; m_ctTimeStop = 0; //}}AFX_DATA_INIT m_hPlayEnableIcon = AfxGetApp()->LoadIcon(IDI_PLAY_ENABLE); m_hPlayDisableIcon = AfxGetApp()->LoadIcon(IDI_PLAY_DISABLE); m_hPauseEnableIcon = AfxGetApp()->LoadIcon(IDI_PAUSE_ENABLE); m_hPauseDisableIcon = AfxGetApp()->LoadIcon(IDI_PAUSE_DISABLE); m_hStopEnableIcon = AfxGetApp()->LoadIcon(IDI_STOP_ENABLE); m_hStopDisableIcon = AfxGetApp()->LoadIcon(IDI_STOP_DISABLE); m_hSoundStartIcon= AfxGetApp()->LoadIcon(IDI_SOUND_ENABLE); m_hSoundStopIcon= AfxGetApp()->LoadIcon(IDI_SOUND_DISABLE); m_hGotoTailDisableIcon = AfxGetApp()->LoadIcon(IDI_GOTOEND_DISABLE); m_hFastDisableIcon = AfxGetApp()->LoadIcon(IDI_FASTFORWARD_DISABLE); m_hSlowDisableIcon= AfxGetApp()->LoadIcon(IDI_FASTBACKWARD_DISABLE); m_hGotoTailEnableIcon = AfxGetApp()->LoadIcon(IDI_GOTOEND_ENABLE); m_hFastEnableIcon = AfxGetApp()->LoadIcon(IDI_FASTFORWARD_ENABLE); m_hSlowEnableIcon = AfxGetApp()->LoadIcon(IDI_FASTBACKWARD_ENABLE); m_hStepBackEnableIcon = AfxGetApp()->LoadIcon(IDI_STEPBACK_ENABLE); m_hStepBackDisableIcon = AfxGetApp()->LoadIcon(IDI_STEPBACK_DISABLE); m_hCaptureIcon = AfxGetApp()->LoadIcon(IDI_PIC); } void CRemoteTimePlay::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CRemoteTimePlay) DDX_Control(pDX, IDC_WND, m_PlayWnd); DDX_Control(pDX, IDC_VOLUME_SLIDER, m_ctlVolume); DDX_Control(pDX, IDC_COMBOSERVER, m_ServerName); DDX_Control(pDX, IDC_COMBOPORT, m_ChannelName); DDX_DateTimeCtrl(pDX, IDC_DATESTART, m_ctDateStart); DDX_DateTimeCtrl(pDX, IDC_DATESTOP, m_ctDateStop); DDX_DateTimeCtrl(pDX, IDC_TIMESTART, m_ctTimeStart); DDX_DateTimeCtrl(pDX, IDC_TIMESTOP, m_ctTimeStop); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CRemoteTimePlay, CDialog) //{{AFX_MSG_MAP(CRemoteTimePlay) ON_BN_CLICKED(IDC_STOP, OnStop) ON_BN_CLICKED(IDC_SLOW, OnSlow) ON_BN_CLICKED(IDC_FAST, OnFast) ON_BN_CLICKED(IDC_CAPPIC, OnCappic) ON_BN_CLICKED(IDC_STEP, OnStep) ON_BN_CLICKED(IDC_SOUND, OnSound) ON_WM_HSCROLL() ON_WM_LBUTTONDBLCLK() ON_BN_CLICKED(IDC_PLAY_TIME, OnPlayTime) ON_CBN_SELCHANGE(IDC_COMBOSERVER, OnSelchangeComboserver) ON_WM_TIMER() ON_BN_CLICKED(IDC_BUTTONDOWNLOAD, OnButtondownload) ON_BN_CLICKED(IDC_BUTTONLOADSAVE, OnButtonloadsave) ON_BN_CLICKED(IDC_GOTOSTART, OnGotostart) //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CRemoteTimePlay message handlers void CRemoteTimePlay::SetParentWnd(HWND *hhWnd, int iParentNum) { VERIFY(iParentNum==2); m_hPareDlgWnd=hhWnd[0]; m_hPareTabWnd=hhWnd[1]; } BOOL CRemoteTimePlay::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here CRect rc(0, 0, 0, 0); GetParent()->GetClientRect(&rc); ((CTabCtrl*)GetParent())->AdjustRect(FALSE, &rc); MoveWindow(&rc); F_InitUI(); m_bPause=FALSE; m_bDown = FALSE; m_bTimeSave = FALSE; m_ServerName.AddString("请选择DVR"); for(int i = 0; i < MAXIPNUMBER; i++) { if(serverinfo[i].m_csServerName != "") m_ServerName.AddString(serverinfo[i].m_csServerName); } m_ServerName.SetCurSel(0); m_ChannelName.SetCurSel(1); CTime time1 = CTime::GetCurrentTime(); CTime time(time1.GetYear(),time1.GetMonth(),time1.GetDay(),0,0,0); CTime time0(time1.GetYear(),time1.GetMonth(),time1.GetDay(),23,59,59); m_ctDateStart = time; m_ctTimeStart = time; m_ctDateStop = time1; m_ctTimeStop = time0; m_ctlVolume.SetRange(1, 100, TRUE); m_ctlVolume.SetPos(50); lHandle = -1; m_lLoadHandle = -1; m_bSound = FALSE; m_bFullScreen = FALSE; m_hPareDlgWnd = NULL; m_hPareTabWnd = NULL; m_lStartChan = 0; GetDlgItem(IDC_WND)->GetWindowRect(m_rcWnd); ScreenToClient(m_rcWnd); m_rcScreen=CRect(0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN)); UpdateData(FALSE); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE } void CRemoteTimePlay::OnPlayTime() { // TODO: Add your control notification handler code here NET_DVR_TIME StartTime,StopTime; UpdateData(TRUE); if(lHandle == -1) { if(m_ServerName.GetCurSel() == 0) { AfxMessageBox("请选择DVR!"); return; } //ServerID = serverinfo[i].m_lServerID; iChannel = m_ChannelName.GetCurSel()+m_lStartChan; StartTime.dwYear = m_ctDateStart.GetYear(); StartTime.dwMonth = m_ctDateStart.GetMonth(); StartTime.dwDay = m_ctDateStart.GetDay(); StartTime.dwHour = m_ctTimeStart.GetHour(); StartTime.dwMinute = m_ctTimeStart.GetMinute(); StartTime.dwSecond = m_ctTimeStart.GetSecond(); StopTime.dwYear = m_ctDateStop.GetYear(); StopTime.dwMonth = m_ctDateStop.GetMonth(); StopTime.dwDay = m_ctDateStop.GetDay(); StopTime.dwHour = m_ctTimeStop.GetHour(); StopTime.dwMinute = m_ctTimeStop.GetMinute(); StopTime.dwSecond = m_ctTimeStop.GetSecond(); lHandle = NET_DVR_PlayBackByTime(ServerID, iChannel, &StartTime, &StopTime, m_PlayWnd.GetSafeHwnd()); if(lHandle == -1) { AfxMessageBox("远程回放失败!"); return; } NET_DVR_PlayBackControl(lHandle, NET_DVR_PLAYSTART, 0, NULL); if(NET_DVR_PlayBackControl(lHandle, NET_DVR_PLAYSTARTAUDIO, 0, NULL)) { m_bSound=TRUE; NET_DVR_PlayBackControl(lHandle, NET_DVR_PLAYAUDIOVOLUME, (0xffff)/2, NULL); m_ctlVolume.SetPos(50); ((CButton *)GetDlgItem(IDC_SOUND))->SetIcon(m_hSoundStartIcon); } else { m_bSound=FALSE; ((CButton *)GetDlgItem(IDC_SOUND))->SetIcon(m_hSoundStopIcon); } F_SetPlayState(); SetTimer(PLAYBYTIME_TIMER,2000,NULL); UpdateData(FALSE); } else { if(m_bPause) { if(NET_DVR_PlayBackControl(lHandle, NET_DVR_PLAYRESTART, 0, NULL)) { m_bPause=FALSE; F_SetPlayState(); } } else { if(NET_DVR_PlayBackControl(lHandle, NET_DVR_PLAYPAUSE, 0, NULL)) { TRACE("handle:%d \n",lHandle); m_bPause=TRUE; CButton *pButton; pButton = (CButton *)GetDlgItem(IDC_PLAY_TIME); pButton->SetIcon(m_hPlayEnableIcon); pButton->EnableWindow(TRUE); } } } } void CRemoteTimePlay::OnStop() { // TODO: Add your control notification handler code here F_StopPlay(); } void CRemoteTimePlay::F_StopPlay() { CButton *pButton; if(lHandle >= 0) { if(m_bFullScreen) { m_bFullScreen = FALSE; F_ShowNormal(); } if(m_bTimeSave) { NET_DVR_StopPlayBackSave(lHandle); m_bTimeSave = FALSE; GetDlgItem(IDC_BUTTONLOADSAVE)->SetWindowText("保存"); } NET_DVR_PlayBackControl(lHandle, NET_DVR_PLAYSTOPAUDIO, 0, NULL); NET_DVR_StopPlayBack(lHandle); lHandle = -1; Invalidate(TRUE); UpdateData(FALSE); KillTimer(PLAYBYTIME_TIMER); } m_bSound=FALSE; m_bPause = FALSE; m_ctlVolume.EnableWindow(FALSE); pButton = (CButton *)GetDlgItem(IDC_PLAY_TIME); pButton->SetIcon(m_hPlayEnableIcon); pButton->EnableWindow(TRUE); pButton = (CButton *)GetDlgItem(IDC_STOP); pButton->SetIcon(m_hStopDisableIcon); pButton->EnableWindow(FALSE); pButton = (CButton *)GetDlgItem(IDC_FAST); pButton->SetIcon(m_hFastDisableIcon); pButton->EnableWindow(FALSE); pButton = (CButton *)GetDlgItem(IDC_SLOW); pButton->SetIcon(m_hSlowDisableIcon); pButton->EnableWindow(FALSE); pButton = (CButton *)GetDlgItem(IDC_CAPPIC); pButton->SetIcon(m_hCaptureIcon); pButton->EnableWindow(FALSE); pButton = (CButton *)GetDlgItem(IDC_SOUND); pButton->SetIcon(m_hSoundStopIcon); pButton->EnableWindow(FALSE); } void CRemoteTimePlay::F_ShowNormal() { GetDlgItem(IDC_WND)->SetWindowPos(NULL,m_rcWnd.left,m_rcWnd.top,m_rcWnd.Width(),m_rcWnd.Height(),SWP_SHOWWINDOW); ::SetWindowPos(m_hWnd,NULL,m_rcParent.left,m_rcParent.top,m_rcParent.Width(),m_rcParent.Height(),SWP_SHOWWINDOW); ::SetWindowPos(m_hPareTabWnd,NULL,m_rcPareTab.left,m_rcPareTab.top,m_rcPareTab.Width(),m_rcPareTab.Height(),SWP_SHOWWINDOW); ::SetWindowPos(m_hPareDlgWnd,NULL,m_rcPareDlg.left,m_rcPareDlg.top,m_rcPareDlg.Width(),m_rcPareDlg.Height(),SWP_SHOWWINDOW); F_EnableFlashWnd(TRUE); Invalidate(FALSE); UpdateWindow(); } void CRemoteTimePlay::OnSlow() { // TODO: Add your control notification handler code here NET_DVR_PlayBackControl(lHandle, NET_DVR_PLAYSLOW, 0, NULL); } void CRemoteTimePlay::OnFast() { // TODO: Add your control notification handler code here NET_DVR_PlayBackControl(lHandle, NET_DVR_PLAYFAST, 0, NULL); } void CRemoteTimePlay::OnCappic() { // TODO: Add your control notification handler code here char cFilename[256]; sprintf(cFilename, "%s\\%d_%d.bmp",ClientParam.m_csPictureSavePath,iChannel, GetTickCount()); if(NET_DVR_PlayBackCaptureFile(lHandle,cFilename)) { CString sTemp; sTemp.Format("抓图成功 %s!",cFilename); AfxMessageBox(sTemp); return; } else { AfxMessageBox("抓图失败!"); } } void CRemoteTimePlay::OnStep() { // TODO: Add your control notification handler code here } void CRemoteTimePlay::OnSound() { // TODO: Add your control notification handler code here CButton *pButton; if(lHandle >= 0) { if(m_bSound) { if(NET_DVR_PlayBackControl(lHandle, NET_DVR_PLAYSTOPAUDIO, 0, NULL)) { m_bSound=FALSE; pButton = (CButton *)GetDlgItem(IDC_SOUND); pButton->SetIcon(m_hSoundStopIcon); } } else { if(NET_DVR_PlayBackControl(lHandle, NET_DVR_PLAYSTARTAUDIO, 0, NULL)) { pButton = (CButton *)GetDlgItem(IDC_SOUND); pButton->SetIcon(m_hSoundStartIcon); m_bSound=TRUE; } } } } void CRemoteTimePlay::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar) { // TODO: Add your message handler code here and/or call default if (GetDlgItem(IDC_VOLUME_SLIDER) == pScrollBar) { char volume; WORD temp, volumevalue; temp = (0xffff)/100; volume = m_ctlVolume.GetPos(); volumevalue = volume*temp; if(lHandle >= 0) NET_DVR_PlayBackControl(lHandle, NET_DVR_PLAYAUDIOVOLUME, volumevalue, NULL); } CDialog::OnHScroll(nSBCode, nPos, pScrollBar); } void CRemoteTimePlay::OnLButtonDblClk(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default if( (IsInWnd(point)) && (lHandle >= 0) ) { m_bFullScreen=!m_bFullScreen; if(m_bFullScreen) F_ShowFullScreen(); else F_ShowNormal(); } CDialog::OnLButtonDblClk(nFlags, point); } BOOL CRemoteTimePlay::IsInWnd(CPoint point) { CRect rc; GetDlgItem(IDC_WND)->GetWindowRect(&rc); ScreenToClient(&rc); if(PtInRect(&rc,point)) return TRUE; else return FALSE; } void CRemoteTimePlay::F_ShowFullScreen() { F_EnableFlashWnd(FALSE); CRect rc,rcClient; ::GetWindowRect(m_hPareDlgWnd,m_rcPareDlg); ::GetWindowRect(m_hPareTabWnd,m_rcPareTab); ::ScreenToClient(m_hPareDlgWnd,(POINT*)(&m_rcPareTab)); ::ScreenToClient(m_hPareDlgWnd,(POINT*)(&m_rcPareTab)+1); ::GetWindowRect(m_hWnd,m_rcParent); ::ScreenToClient(m_hPareTabWnd,(POINT*)(&m_rcParent)); ::ScreenToClient(m_hPareTabWnd,(POINT*)(&m_rcParent)+1); ::SetWindowPos(m_hPareDlgWnd,NULL,m_rcScreen.left-SCREEN_EDGE,m_rcScreen.top-SCREEN_EDGE,m_rcScreen.Width()+2*SCREEN_EDGE,m_rcScreen.Height()+2*SCREEN_EDGE,SWP_SHOWWINDOW); ::GetClientRect(m_hPareDlgWnd,rc); ::SetWindowPos(m_hPareTabWnd,NULL,rc.left,rc.top,rc.Width(),rc.Height(),SWP_SHOWWINDOW); ::GetClientRect(m_hPareTabWnd,rc); ::SetWindowPos(m_hWnd,NULL,rc.left,rc.top,rc.Width(),rc.Height(),SWP_SHOWWINDOW); GetDlgItem(IDC_WND)->GetClientRect(rcClient); GetDlgItem(IDC_WND)->GetWindowRect(rc); int iEdge=(rc.Width()-rcClient.Width())/2; rc=m_rcScreen; rc.left-=iEdge; rc.right+=iEdge; rc.top-=iEdge; rc.bottom+=iEdge; this->ScreenToClient(rc); ::SetWindowPos(GetDlgItem(IDC_WND)->m_hWnd,NULL,rc.left,rc.top,rc.Width(),rc.Height(),SWP_SHOWWINDOW); Invalidate(FALSE); UpdateWindow(); } void CRemoteTimePlay::F_EnableFlashWnd(BOOL bEnable) { if(bEnable) { //THE same to multiplay GetDlgItem(IDC_COMBOSERVER)->ModifyStyle(0,WS_VISIBLE,0); GetDlgItem(IDC_COMBOPORT)->ModifyStyle(0,WS_VISIBLE,0); GetDlgItem(IDC_DATESTART)->ModifyStyle(0,WS_VISIBLE,0); GetDlgItem(IDC_DATESTOP)->ModifyStyle(0,WS_VISIBLE,0); GetDlgItem(IDC_TIMESTOP)->ModifyStyle(0,WS_VISIBLE,0); GetDlgItem(IDC_TIMESTART)->ModifyStyle(0,WS_VISIBLE,0); GetDlgItem(IDC_PLAY_TIME)->ModifyStyle(0,WS_VISIBLE,0); GetDlgItem(IDC_STOP)->ModifyStyle(0,WS_VISIBLE,0); GetDlgItem(IDC_SLOW)->ModifyStyle(0,WS_VISIBLE,0); GetDlgItem(IDC_FAST)->ModifyStyle(0,WS_VISIBLE,0); GetDlgItem(IDC_CAPPIC)->ModifyStyle(0,WS_VISIBLE,0); GetDlgItem(IDC_SOUND)->ModifyStyle(0,WS_VISIBLE,0); GetDlgItem(IDC_VOLUME_SLIDER)->ModifyStyle(0,WS_VISIBLE,0); } else { //THE same to multiplay GetDlgItem(IDC_COMBOSERVER)->ModifyStyle(WS_VISIBLE,0,0); GetDlgItem(IDC_COMBOPORT)->ModifyStyle(WS_VISIBLE,0,0); GetDlgItem(IDC_DATESTART)->ModifyStyle(WS_VISIBLE,0,0); GetDlgItem(IDC_DATESTOP)->ModifyStyle(WS_VISIBLE,0,0); GetDlgItem(IDC_TIMESTOP)->ModifyStyle(WS_VISIBLE,0,0); GetDlgItem(IDC_TIMESTART)->ModifyStyle(WS_VISIBLE,0,0); GetDlgItem(IDC_PLAY_TIME)->ModifyStyle(WS_VISIBLE,0,0); GetDlgItem(IDC_STOP)->ModifyStyle(WS_VISIBLE,0,0); GetDlgItem(IDC_SLOW)->ModifyStyle(WS_VISIBLE,0,0); GetDlgItem(IDC_FAST)->ModifyStyle(WS_VISIBLE,0,0); GetDlgItem(IDC_CAPPIC)->ModifyStyle(WS_VISIBLE,0,0); GetDlgItem(IDC_SOUND)->ModifyStyle(WS_VISIBLE,0,0); GetDlgItem(IDC_VOLUME_SLIDER)->ModifyStyle(WS_VISIBLE,0,0); } } void CRemoteTimePlay::F_InitUI() { CButton *pButton; pButton = (CButton *)GetDlgItem(IDC_PLAY_TIME); pButton->SetIcon(m_hPlayEnableIcon); pButton->EnableWindow(TRUE); pButton = (CButton *)GetDlgItem(IDC_STOP); pButton->SetIcon(m_hStopDisableIcon); pButton->EnableWindow(FALSE); pButton = (CButton *)GetDlgItem(IDC_FAST); pButton->SetIcon(m_hFastDisableIcon); pButton->EnableWindow(FALSE); pButton = (CButton *)GetDlgItem(IDC_SLOW); pButton->SetIcon(m_hSlowDisableIcon); pButton->EnableWindow(FALSE); pButton = (CButton *)GetDlgItem(IDC_CAPPIC); pButton->SetIcon(m_hCaptureIcon); pButton->EnableWindow(FALSE); pButton = (CButton *)GetDlgItem(IDC_SOUND); pButton->SetIcon(m_hSoundStopIcon); pButton->EnableWindow(FALSE); } void CRemoteTimePlay::F_SetPlayState() { m_ctlVolume.EnableWindow(TRUE); CButton *pButton; pButton = (CButton *)GetDlgItem(IDC_PLAY_TIME); pButton->SetIcon(m_hPauseEnableIcon); pButton->EnableWindow(TRUE); pButton = (CButton *)GetDlgItem(IDC_STOP); pButton->SetIcon(m_hStopEnableIcon); pButton->EnableWindow(TRUE); pButton = (CButton *)GetDlgItem(IDC_FAST); pButton->SetIcon(m_hFastEnableIcon); pButton->EnableWindow(TRUE); pButton = (CButton *)GetDlgItem(IDC_SLOW); pButton->SetIcon(m_hSlowEnableIcon); pButton->EnableWindow(TRUE); pButton = (CButton *)GetDlgItem(IDC_CAPPIC); pButton->SetIcon(m_hCaptureIcon); pButton->EnableWindow(TRUE); pButton = (CButton *)GetDlgItem(IDC_SOUND); if(m_bSound) pButton->SetIcon(m_hSoundStartIcon); else pButton->SetIcon(m_hSoundStopIcon); pButton->EnableWindow(TRUE); } void CRemoteTimePlay::OnCancel() { // TODO: Add extra cleanup here // CDialog::OnCancel(); } void CRemoteTimePlay::OnSelchangeComboserver() { // TODO: Add your control notification handler code here int iSelServer = m_ServerName.GetCurSel() - 1; if(iSelServer < 0) return; ServerID = serverinfo[iSelServer].m_lServerID; m_lStartChan = serverinfo[iSelServer].m_lStartChannel; int m_iChanNum = serverinfo[iSelServer].m_iServerChannelNumber; m_ChannelName.ResetContent(); CString sTemp; for(int i=0; i= 0) { NET_DVR_PlayBackControl(lHandle, NET_DVR_PLAYGETPOS, 0, &nPos); if(nPos > 100) //由于网络原因或DVR忙,回放或下载异常终止 { F_StopPlay(); AfxMessageBox("由于网络原因或DVR忙,回放异常终止!"); } if(nPos == 100) { F_StopPlay(); AfxMessageBox("按时间回放结束!"); } } } else if(nIDEvent == DOWNBYTIME_TIMER) { if(m_bDown) { NET_DVR_PlayBackControl(m_lLoadHandle, NET_DVR_PLAYGETPOS, 0, &nPos); if(nPos > 100) //由于网络原因或DVR忙,回放或下载异常终止 { m_bDown=FALSE; NET_DVR_StopGetFile(m_lLoadHandle); GetDlgItem(IDC_BUTTONDOWNLOAD)->SetWindowText("下载"); AfxMessageBox("由于网络原因或DVR忙,下载异常终止!"); } if(nPos == 100) { m_bDown=FALSE; NET_DVR_StopGetFile(m_lLoadHandle); GetDlgItem(IDC_BUTTONDOWNLOAD)->SetWindowText("下载"); AfxMessageBox("按时间下载结束!"); } } } CDialog::OnTimer(nIDEvent); } void CRemoteTimePlay::OnButtondownload() { // TODO: Add your control notification handler code here CString csFileName; CString csStartTime, csStopTime; CString csTemp,csDir; char nFileName[256]; UpdateData(TRUE); if(!m_bDown) { if(m_ServerName.GetCurSel() == 0) { AfxMessageBox("请选择DVR!"); return; } int iSelServer = m_ServerName.GetCurSel() - 1; iChannel = m_ChannelName.GetCurSel()+m_lStartChan; csStartTime.Format("%04d%02d%02d%02d%02d%02d",m_ctDateStart.GetYear(),m_ctDateStart.GetMonth(), m_ctDateStart.GetDay(), m_ctTimeStart.GetHour(), m_ctTimeStart.GetMinute(), m_ctTimeStart.GetSecond()); csStopTime.Format("%04d%02d%02d%02d%02d%02d",m_ctDateStop.GetYear(),m_ctDateStop.GetMonth(), m_ctDateStop.GetDay(), m_ctTimeStop.GetHour(), m_ctTimeStop.GetMinute(), m_ctTimeStop.GetSecond()); csDir.Format("%s\\",ClientParam.m_csDownLoadPath); sprintf(nFileName,"%s%s_%02d_D%s_%sTime.mp4",csDir,serverinfo[iSelServer].m_csServerIP, iChannel,csStartTime,csStopTime); TRACE("Download file name: %s \n", nFileName); NET_DVR_TIME StartTime,StopTime; UpdateData(TRUE); StartTime.dwYear = m_ctDateStart.GetYear(); StartTime.dwMonth = m_ctDateStart.GetMonth(); StartTime.dwDay = m_ctDateStart.GetDay(); StartTime.dwHour = m_ctTimeStart.GetHour(); StartTime.dwMinute = m_ctTimeStart.GetMinute(); StartTime.dwSecond = m_ctTimeStart.GetSecond(); StopTime.dwYear = m_ctDateStop.GetYear(); StopTime.dwMonth = m_ctDateStop.GetMonth(); StopTime.dwDay = m_ctDateStop.GetDay(); StopTime.dwHour = m_ctTimeStop.GetHour(); StopTime.dwMinute = m_ctTimeStop.GetMinute(); StopTime.dwSecond = m_ctTimeStop.GetSecond(); m_lLoadHandle = NET_DVR_GetFileByTime(ServerID,iChannel, &StartTime, &StopTime, nFileName); if(m_lLoadHandle >= 0) { NET_DVR_PlayBackControl(m_lLoadHandle, NET_DVR_PLAYSTART, 0, NULL); GetDlgItem(IDC_BUTTONDOWNLOAD)->SetWindowText("停止下载"); m_bDown=TRUE; SetTimer(DOWNBYTIME_TIMER,1000,NULL); } else { AfxMessageBox("按时间下载失败!"); CString sTemp; sTemp.Format("ERROR: NET_DVR_GetFileByTime = %d",NET_DVR_GetLastError()); TRACE(sTemp); return; } } else { NET_DVR_StopGetFile(m_lLoadHandle); m_bDown=FALSE; GetDlgItem(IDC_BUTTONDOWNLOAD)->SetWindowText("下载"); KillTimer(DOWNBYTIME_TIMER); Invalidate(TRUE); } UpdateData(FALSE); } void CRemoteTimePlay::OnButtonloadsave() { // TODO: Add your control notification handler code here if(!m_bTimeSave) { //zxy 2005-01-04 static char szFilter[]="All File(*.*)|*.*||"; char m_sFile[256] = "c:\\SavefileByTime.mp4"; CString csFile; CFileDialog dlg(FALSE,"*.mp4","SavefileByTime.mp4",OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT, szFilter); if(dlg.DoModal()==IDOK) { csFile = dlg.GetPathName(); UpdateData(FALSE); sprintf(m_sFile, "%s", csFile); if(NET_DVR_PlayBackSaveData(lHandle, m_sFile)) { m_bTimeSave = TRUE; GetDlgItem(IDC_BUTTONLOADSAVE)->SetWindowText("停止保存"); } } } else { NET_DVR_StopPlayBackSave(lHandle); m_bTimeSave = FALSE; GetDlgItem(IDC_BUTTONLOADSAVE)->SetWindowText("保存"); } } //zxy 2005-01-04 /* void CRemoteTimePlay::OnButplay() { // TODO: Add your control notification handler code here NET_DVR_TIME StartTime,StopTime; UpdateData(TRUE); if(m_ServerName.GetCurSel() == 0) { AfxMessageBox("请选择DVR!"); return; } iChannel = m_ChannelName.GetCurSel()+m_lStartChan; StartTime.dwYear = m_ctDateStart.GetYear(); StartTime.dwMonth = m_ctDateStart.GetMonth(); StartTime.dwDay = m_ctDateStart.GetDay(); StartTime.dwHour = m_ctTimeStart.GetHour(); StartTime.dwMinute = m_ctTimeStart.GetMinute(); StartTime.dwSecond = m_ctTimeStart.GetSecond(); StopTime.dwYear = m_ctDateStop.GetYear(); StopTime.dwMonth = m_ctDateStop.GetMonth(); StopTime.dwDay = m_ctDateStop.GetDay(); StopTime.dwHour = m_ctTimeStop.GetHour(); StopTime.dwMinute = m_ctTimeStop.GetMinute(); StopTime.dwSecond = m_ctTimeStop.GetSecond(); // if(NET_DVR_PlayBackByTimeLocDisplay(ServerID, iChannel, &StartTime, &StopTime)) { TRACE("远程控制本地回放成功!"); } } void CRemoteTimePlay::OnButstop() { // TODO: Add your control notification handler code here // if(NET_DVR_StopLocDisplayPlay(ServerID)) { TRACE("停止远程控制本地回放成功!"); } } */ void CRemoteTimePlay::OnGotostart() { // TODO: Add your control notification handler code here }