123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248 |
- // RemoteFilePlay.cpp : implementation file
- //
- #include "stdafx.h"
- #include "StoneU_HC_OCX.h"
- #include "RemoteFilePlay.h"
- #include "newclientDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CRemoteFilePlay dialog
- extern SERVER_INFO serverinfo[MAXIPNUMBER];
- extern CLIENTPARAM ClientParam;
- BOOL g_bRmtCapPic = FALSE;
- CRemoteFilePlay * RFile;
- HANDLE hFile;
- int nTemp = 0;
- extern CNewclientDlg *g_NewClientDlg;
- void CALLBACK PlayDataCallBack(LONG lPlayHandle, DWORD dwDataType, BYTE *pBuffer,DWORD dwBufSize,DWORD dwUser)
- {
- //TRACE("lPlayHandle = %d dwUser = %d dwDataType = %d dwBufSize = %d", lPlayHandle, dwUser, dwDataType, dwBufSize);
-
- }
- //////////////////////////////////////////
- UINT GetFileThread(LPVOID pParam)
- {
- LONG bRet = -1;
- NET_DVR_FIND_DATA strFileInfo;
- CString tempstring;
- //int ntemp,ntemp1;
- char tempfile[100];
-
- while(1)
- {
- bRet = NET_DVR_FindNextFile(RFile->m_lFileHandle, &strFileInfo);
- if(bRet == NET_DVR_FILE_SUCCESS)
- {
- strcpy(tempfile,strFileInfo.sFileName);
- RFile->m_Filelist.InsertItem(RFile->m_iFileNum,tempfile,0);
- tempstring.Format("%d",strFileInfo.dwFileSize);
- RFile->m_Filelist.SetItemText(RFile->m_iFileNum,1,tempstring);
- tempstring.Format("%04d%02d%02d%02d%02d%02d",strFileInfo.struStartTime.dwYear, strFileInfo.struStartTime.dwMonth,strFileInfo.struStartTime.dwDay,strFileInfo.struStartTime.dwHour,strFileInfo.struStartTime.dwMinute,strFileInfo.struStartTime.dwSecond);
- RFile->m_Filelist.SetItemText(RFile->m_iFileNum,2,tempstring);
- tempstring.Format("%04d%02d%02d%02d%02d%02d",strFileInfo.struStopTime.dwYear, strFileInfo.struStopTime.dwMonth,strFileInfo.struStopTime.dwDay,strFileInfo.struStopTime.dwHour,strFileInfo.struStopTime.dwMinute,strFileInfo.struStopTime.dwSecond);
- RFile->m_Filelist.SetItemText(RFile->m_iFileNum,3,tempstring);
- RFile->m_iFileNum++;
- }
- else
- {
- if(bRet == NET_DVR_ISFINDING)
- {
- Sleep(5);
- continue;
- }
- if( (bRet == NET_DVR_NOMOREFILE) || (bRet == NET_DVR_FILE_NOFIND) )
- {
- RFile->GetDlgItem(IDC_SEARCHLIST)->SetWindowText("查找"); // by zxy 2005/05/10
- RFile->m_bSearchDown = FALSE;
- (RFile->GetDlgItem(IDC_STATICSTATE))->ShowWindow(SW_HIDE);
-
- RFile->m_iFileNum = 0;
- if(RFile->m_nPlayHandle == -1)
- RFile->F_SetStopState();
- break;
- }
- else
- {
- RFile->GetDlgItem(IDC_SEARCHLIST)->SetWindowText("查找");
- RFile->m_bSearchDown = FALSE;
- (RFile->GetDlgItem(IDC_STATICSTATE))->ShowWindow(SW_HIDE);
-
- MessageBox(g_NewClientDlg->GetSafeHwnd(),"由于服务器忙,或网络故障,获取文件列表异常终止!", "温馨提示", MB_ICONINFORMATION);
- RFile->m_iFileNum = 0;
- if(RFile->m_nPlayHandle == -1)
- RFile->F_SetStopState();
- break;
- }
- }
- }
- CloseHandle(RFile->m_hFileThread);
- RFile->m_hFileThread = NULL;
- NET_DVR_FindClose(RFile->m_lFileHandle);
- return 0;
- }
- CRemoteFilePlay::CRemoteFilePlay(CWnd* pParent /*=NULL*/)
- : CDialog(CRemoteFilePlay::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CRemoteFilePlay)
- m_ctDateStart = 0;
- m_ctDateStop = 0;
- m_ctTimeStart = 0;
- m_ctTimeStop = 0;
- m_sCardNum = _T("");
- m_staticdownload = _T("");
- m_bCard = FALSE;
- //}}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_hGotoHeadDisableIcon = AfxGetApp()->LoadIcon(IDI_GOTOSTART_DISABLE);
- m_hGotoTailDisableIcon = AfxGetApp()->LoadIcon(IDI_GOTOEND_DISABLE);
- m_hFastDisableIcon = AfxGetApp()->LoadIcon(IDI_FASTFORWARD_DISABLE);
- m_hSlowDisableIcon= AfxGetApp()->LoadIcon(IDI_FASTBACKWARD_DISABLE);
- m_hGotoHeadEnableIcon = AfxGetApp()->LoadIcon(IDI_GOTOSTART_ENABLE);
- m_hGotoTailEnableIcon = AfxGetApp()->LoadIcon(IDI_GOTOEND_ENABLE);
- m_hFastEnableIcon = AfxGetApp()->LoadIcon(IDI_FASTFORWARD_ENABLE);
- m_hSlowEnableIcon = AfxGetApp()->LoadIcon(IDI_FASTBACKWARD_ENABLE);
- m_hStepEnableIcon= AfxGetApp()->LoadIcon(IDI_STEP_ENABLE);
- m_hStepDisableIcon = AfxGetApp()->LoadIcon(IDI_STEP_DISABLE);
- m_hStepBackEnableIcon = AfxGetApp()->LoadIcon(IDI_STEPBACK_ENABLE);
- m_hStepBackDisableIcon = AfxGetApp()->LoadIcon(IDI_STEPBACK_DISABLE);
- m_hCaptureIcon = AfxGetApp()->LoadIcon(IDI_PIC);
- }
- void CRemoteFilePlay::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CRemoteFilePlay)
- DDX_Control(pDX, IDC_REMOTEFILRLIST, m_Filelist);
- DDX_Control(pDX, IDC_COMBOPORT, m_ChannelCtrl);
- DDX_Control(pDX, IDC_PROGRESS_SLIDER, m_ctlProgress);
- DDX_Control(pDX, IDC_WND, m_PlayWnd);
- DDX_Control(pDX, IDC_DOWNPROGRESS, m_downProgress);
- DDX_Control(pDX, IDC_COMBOSERVER, m_ServerCtrl);
- DDX_Control(pDX, IDC_COMBOFILETYPE, m_FileType);
- DDX_Control(pDX, IDC_VOLUME_SLIDER, m_ctlVolume);
- 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);
- DDX_Text(pDX, IDC_CARDNUM, m_sCardNum);
- DDX_Text(pDX, IDC_STATICSTATE2, m_staticdownload);
- DDX_Check(pDX, IDC_CHKCARD, m_bCard);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CRemoteFilePlay, CDialog)
- //{{AFX_MSG_MAP(CRemoteFilePlay)
- ON_NOTIFY(NM_DBLCLK, IDC_REMOTEFILRLIST, OnDblclkRemotefilrlist)
- ON_WM_HSCROLL()
- ON_WM_LBUTTONDBLCLK()
- ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_PROGRESS_SLIDER, OnReleasedcaptureProgressSlider)
- ON_WM_TIMER()
- ON_BN_CLICKED(IDC_SEARCHLIST, OnSearchlist)
- ON_BN_CLICKED(IDC_DOWNLOAD, OnDownload)
- ON_BN_CLICKED(IDC_PLAY_FILE, OnPlayFile)
- 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_DESTROY()
- ON_CBN_SELCHANGE(IDC_COMBOSERVER, OnSelchangeComboserver)
- ON_BN_CLICKED(IDC_BUTTONSAVE, OnButtonsave)
- ON_BN_CLICKED(IDC_BUTTONSTOPSAVE, OnButtonstopsave)
- ON_BN_CLICKED(IDC_GOTOSTART, OnGotostart)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CRemoteFilePlay message handlers
- void CRemoteFilePlay::SetParentWnd(HWND *hhWnd, int iParentNum)
- {
- VERIFY(iParentNum==2);
- m_hPareDlgWnd=hhWnd[0];
- m_hPareTabWnd=hhWnd[1];
- }
- BOOL CRemoteFilePlay::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();
- RFile=this;
- m_bDown=FALSE;
- m_bSearchDown = FALSE;
- m_nPlayHandle = -1;
- m_bSound=TRUE;
- g_bRmtCapPic=FALSE;
- m_bPause=FALSE;
- m_bSetFrame = FALSE;
- bGetMaxTime = FALSE;
- m_bFullScreen = FALSE;
- m_bSaveFile = FALSE;
- m_hPareDlgWnd = NULL;
- m_hPareTabWnd = NULL;
- m_hPlayWnd = GetDlgItem(IDC_WND)->m_hWnd;
- m_ctlVolume.SetRange(0,100);
- m_ctlProgress.SetRange(0,100);
- m_downProgress.SetRange(0,100);
- m_ctlProgress.SetPos(0);
- m_downProgress.SetPos(0);
- m_ctlVolume.SetPos(50);
- m_ServerCtrl.AddString("请选择DVR");
- for(int i = 0; i < MAXIPNUMBER; i++)
- {
- if(serverinfo[i].m_csServerName != "")
- m_ServerCtrl.AddString(serverinfo[i].m_csServerName);
- }
- iFileType = 0;
- GetDlgItem(IDC_STATICCARDNUM)->ShowWindow(SW_SHOW);
- GetDlgItem(IDC_CARDNUM)->ShowWindow(SW_SHOW);
- m_ServerCtrl.SetCurSel(0);
- m_ChannelCtrl.SetCurSel(1);
- m_FileType.SetCurSel(iFileType);
- m_iChannel = 0;
- m_Filelist.InsertColumn(0,"文件名称",LVCFMT_LEFT,120,-1);
- m_Filelist.InsertColumn(1,"文件大小",LVCFMT_LEFT,70,-1);
- m_Filelist.InsertColumn(2,"开始时间",LVCFMT_LEFT,110,-1);
- m_Filelist.InsertColumn(3,"结束时间",LVCFMT_LEFT,110,-1);
- GetDlgItem(IDC_WND)->GetWindowRect(m_rcWnd);
- ScreenToClient(m_rcWnd);
- m_hFileThread = NULL;
- lFileHandle = -1;
- m_iFileNum = 0;
- m_nFileTime = 0;
- m_nTotalFrames = 0;
- m_nTotalSecond = 0;
- m_nTotalMinute = 0;
- m_nTotalHour = 0;
- 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 = time;
- m_ctTimeStop = time0;
- UpdateData(FALSE);
- m_bFindFile = FALSE;
- m_bFileDownload = FALSE;
- m_lStartChan = 0;
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CRemoteFilePlay::OnDestroy()
- {
- KillTimer(DOWNSTATE_TIMER);
- CDialog::OnDestroy();
- // TODO: Add your message handler code here
-
- }
- void CRemoteFilePlay::OnDblclkRemotefilrlist(NMHDR* pNMHDR, LRESULT* pResult)
- {
- // TODO: Add your control notification handler code here
- OnStop();
- OnPlayFile();
- *pResult = 0;
- }
- void CRemoteFilePlay::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
- {
- // TODO: Add your message handler code here and/or call default
- char volume = 0;
- WORD temp = (0xffff)/100;
- WORD volumevalue = 0;
- if (GetDlgItem(IDC_VOLUME_SLIDER) == pScrollBar)
- {
- volume =(char)m_ctlVolume.GetPos();
- volumevalue =(WORD) (volume*temp);
- if(m_nPlayHandle >= 0)
- NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYAUDIOVOLUME, volumevalue, NULL);
- }
- if (GetDlgItem(IDC_PROGRESS_SLIDER) == pScrollBar)
- {
- char cpos = (char)(m_ctlProgress.GetPos());
- if(m_nPlayHandle >= 0)
- {
- if ((cpos >=0) && (cpos <=100))
- {
- if(cpos == 100)
- {
- //F_StopPlay();
- cpos = 99;
- }
- else
- {
- NET_DVR_PlayBackControl(m_nPlayHandle,NET_DVR_PLAYSETPOS, cpos, NULL);
- }
- }
- }
- }
-
- CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
- }
- void CRemoteFilePlay::OnLButtonDblClk(UINT nFlags, CPoint point)
- {
- // TODO: Add your message handler code here and/or call default
- if( (IsInWnd(point)) && (m_nPlayHandle>=0) )
- {
- m_bFullScreen=!m_bFullScreen;
- if(m_bFullScreen)
- F_ShowFullScreen();
- else
- F_ShowNormal();
- }
- CDialog::OnLButtonDblClk(nFlags, point);
- }
- void CRemoteFilePlay::OnReleasedcaptureProgressSlider(NMHDR* pNMHDR, LRESULT* pResult)
- {
- // TODO: Add your control notification handler code here
- *pResult = 0;
- }
- void CRemoteFilePlay::OnTimer(UINT nIDEvent)
- {
- // TODO: Add your message handler code here and/or call default
- int nPos;
- DWORD nPos1;
- DWORD nCurrentTime = 0,nHour = 0,nMinute = 0,nSecond = 0,nCurrentFrame = 0;
- DWORD nPlayedFrames = 0;
- CString csText;
- NET_DVR_TIME OsdTime;
-
- switch(nIDEvent) {
- case DOWNSTATE_TIMER:
- if(m_bDown)
- {
- nPos = NET_DVR_GetDownloadPos(lFileHandle);
- if(nPos < 0) //失败
- {
- NET_DVR_StopGetFile(lFileHandle);
- m_downProgress.ShowWindow(SW_HIDE);
- RFile->GetDlgItem(IDC_DOWNLOAD)->SetWindowText("下载");
- RFile->m_bDown=FALSE;
- m_staticdownload.Format("停止下载文件%s", filenamedownload);
- GetDlgItem(IDC_STATICSTATE2)->ShowWindow(SW_HIDE);
-
- MessageBox("获取下载进度失败!", "温馨提示", MB_ICONINFORMATION);
- }
- if(nPos == 100) //下载结束
- {
- NET_DVR_StopGetFile(lFileHandle);
- m_downProgress.ShowWindow(SW_HIDE);
- RFile->GetDlgItem(IDC_DOWNLOAD)->SetWindowText("下载");
- RFile->m_bDown=FALSE;
- m_staticdownload.Format("下载文件结束%s", filenamedownload);
- GetDlgItem(IDC_STATICSTATE2)->ShowWindow(SW_HIDE);
-
- MessageBox("下载完毕!", "温馨提示", MB_ICONINFORMATION);
- }
- if(nPos > 100) //由于网络原因或DVR忙,下载异常终止
- {
- NET_DVR_StopGetFile(lFileHandle);
- m_downProgress.ShowWindow(SW_HIDE);
- RFile->GetDlgItem(IDC_DOWNLOAD)->SetWindowText("下载");
- RFile->m_bDown=FALSE;
- m_staticdownload.Format("停止下载文件%s", filenamedownload);
- GetDlgItem(IDC_STATICSTATE2)->ShowWindow(SW_HIDE);
-
- MessageBox("由于网络原因或DVR忙,下载异常终止!", "温馨提示", MB_ICONINFORMATION);
- }
- else
- {
- m_downProgress.SetPos(nPos);
- }
- }
- break;
- case RPSTATE_TIMER:
- // nTemp++;
- // if (nTemp == 5)
- // NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYSETPOS, 80, NULL);
-
- if(!bGetMaxTime)
- {
- NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_GETTOTALTIME, 0, &m_nFileTime);
- if(m_nFileTime == 0)
- return;
-
- NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_GETTOTALFRAMES, 0, &m_nTotalFrames);
- if(m_nTotalFrames == 0)
- return;
- m_nTotalHour=m_nFileTime/3600;
- m_nTotalMinute=(m_nFileTime%3600)/60;
- m_nTotalSecond=m_nFileTime%60;
- bGetMaxTime = TRUE;
- }
- NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYGETTIME, 0, &nCurrentTime);
- if(nCurrentTime >= m_nFileTime)
- {
- nCurrentTime = m_nFileTime;
- }
- nHour=(nCurrentTime/3600)%24;
- nMinute=(nCurrentTime%3600)/60;
- nSecond=nCurrentTime%60;
- NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYGETFRAME, 0, &nCurrentFrame);
- if(nCurrentFrame>m_nTotalFrames)
- nCurrentFrame = m_nTotalFrames;
- csText.Format("%d/%d %02d:%02d:%02d/%02d:%02d:%02d %s",nCurrentFrame,m_nTotalFrames,nHour,nMinute,nSecond,m_nTotalHour,m_nTotalMinute,m_nTotalSecond,filename);
- GetDlgItem(IDC_PLAYSTATUS)->SetWindowText(csText);
-
- NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYGETPOS, 0, &nPos1);
- if(nPos1 > 100) //由于网络原因或DVR忙,回放异常终止
- {
- F_StopPlay();
-
- MessageBox("由于网络原因或DVR忙,回放异常终止!", "温馨提示", MB_ICONINFORMATION);
- }
- else
- {
- m_ctlProgress.SetPos(nPos1);
- if(nPos1 == 100)
- {
- F_StopPlay();
- TRACE("回放文件结束!");
- }
- }
-
- if(NET_DVR_GetPlayBackOsdTime(m_nPlayHandle, &OsdTime))
- {
- //TRACE("OSDTime: %04d%02d%02d%02d%02d%02d", OsdTime.dwYear, OsdTime.dwMonth,OsdTime.dwDay,OsdTime.dwHour,OsdTime.dwMinute,OsdTime.dwSecond);
- }
- break;
- default:
- break;
- }
- CDialog::OnTimer(nIDEvent);
- }
- void CRemoteFilePlay::OnSearchlist()
- {
- // TODO: Add your control notification handler code here
- UpdateData(TRUE);
-
- m_Filelist.DeleteAllItems();
- iSelServer = m_ServerCtrl.GetCurSel()-1;
- if (iSelServer < 0)
- {
- MessageBox("请选择一个DVR!", "温馨提示", MB_ICONINFORMATION);
-
- return;
- }
- if(!m_bSearchDown)
- {
- NET_DVR_TIME StartTime;
- NET_DVR_TIME StopTime;
-
- m_iChannel = m_ChannelCtrl.GetCurSel()+m_lStartChan;
- iFileType = m_FileType.GetCurSel();
- StartTime.dwYear = (WORD)m_ctDateStart.GetYear();
- StartTime.dwMonth = (WORD)m_ctDateStart.GetMonth();
- StartTime.dwDay = (WORD)m_ctDateStart.GetDay();
- StartTime.dwHour = (char)m_ctTimeStart.GetHour();
- StartTime.dwMinute = (char)m_ctTimeStart.GetMinute();
- StartTime.dwSecond = (char)m_ctTimeStart.GetSecond();
- StopTime.dwYear = (WORD)m_ctDateStop.GetYear();
- StopTime.dwMonth = (WORD)m_ctDateStop.GetMonth();
- StopTime.dwDay = (WORD)m_ctDateStop.GetDay();
- StopTime.dwHour = (char)m_ctTimeStop.GetHour();
- StopTime.dwMinute = (char)m_ctTimeStop.GetMinute();
- StopTime.dwSecond = (char)m_ctTimeStop.GetSecond();
-
- m_lServerType = serverinfo[iSelServer].m_wServerType;
- if(m_bCard) //ATM DVR
- {
- BYTE cTemp[CARDNUM_LEN];
- memcpy(cTemp, m_sCardNum, CARDNUM_LEN);
- if(iFileType == 0)
- {
- iFileType = 0xFF;
- }
- else
- {
- iFileType -= 1;
- }
- m_lFileHandle = NET_DVR_FindFileByCard(m_lServerID,m_iChannel,iFileType, TRUE, cTemp, &StartTime, &StopTime);
- }
- else
- {
- if(iFileType == 0)
- {
- iFileType = 0xFF;
- }
- else
- {
- iFileType -= 1;
- }
- m_lFileHandle = NET_DVR_FindFile(m_lServerID,m_iChannel,iFileType, &StartTime, &StopTime);
- }
-
- if(m_lFileHandle < 0)
- {
- MessageBox("获取文件列表失败!", "温馨提示", MB_ICONINFORMATION);
-
- CString sTemp;
- sTemp.Format("ERROR: NET_DVR_FindFile = %d",NET_DVR_GetLastError());
- TRACE(sTemp);
- return;
- }
- m_Filelist.DeleteAllItems();
- m_bFindFile = TRUE;
- DWORD dwThreadId;
- if(m_hFileThread == NULL)
- m_hFileThread = CreateThread(NULL,0,LPTHREAD_START_ROUTINE(GetFileThread),this,0,&dwThreadId);
- if(m_hFileThread == NULL)
- {
- MessageBox("打开线程失败!", "温馨提示", MB_ICONINFORMATION);
-
- return;
- }
- GetDlgItem(IDC_SEARCHLIST)->SetWindowText("停止查找");
- m_bSearchDown = TRUE;
- GetDlgItem(IDC_STATICSTATE)->ShowWindow(SW_SHOW);
- }
- else
- {
- if(m_hFileThread)
- {
- TerminateThread(m_hFileThread, 0);
- }
- CloseHandle(m_hFileThread);
- m_hFileThread = NULL;
- NET_DVR_FindClose(m_lFileHandle);
-
- GetDlgItem(IDC_SEARCHLIST)->SetWindowText("查找");
- m_bSearchDown = FALSE;
- GetDlgItem(IDC_STATICSTATE)->ShowWindow(SW_HIDE);
- m_iFileNum = 0;
- }
- }
- void CRemoteFilePlay::OnDownload()
- {
- // TODO: Add your control notification handler code here
- CString csFileName;
- CString csStartTime, csStopTime;
- CString csTemp,csDir;
- char nFileName[256];
- POSITION pos;
- int fileselpos = 0;
- // VERIFYINFO strVerifyInfo;
- int m_nVerifyret = -1;
-
- UpdateData(TRUE);
- if(!m_bDown)
- {
- pos = m_Filelist.GetFirstSelectedItemPosition();
- if(pos == NULL)
- {
- MessageBox("请选择要下载的文件!", "温馨提示", MB_ICONINFORMATION);
-
- return;
- }
- fileselpos = m_Filelist.GetNextSelectedItem(pos);
- csFileName.Format("%s",m_Filelist.GetItemText(fileselpos,0));
- if(csFileName.IsEmpty())
- return;
- csStartTime.Format("%s",m_Filelist.GetItemText(fileselpos,2));
- csStopTime.Format("%s",m_Filelist.GetItemText(fileselpos,3));
- sprintf(filenamedownload,"%s",csFileName);
- csDir.Format("%s\\",ClientParam.m_csDownLoadPath);
- sprintf(nFileName,"%s%s_%02d_D%s_%s.mp4",csDir,serverinfo[iSelServer].m_csServerIP, m_iChannel,csStartTime,csStopTime);
- TRACE("Download file name: %s \n", nFileName);
- lFileHandle = NET_DVR_GetFileByName(m_lServerID,filenamedownload,nFileName);
- if(lFileHandle >= 0)
- {
- NET_DVR_PlayBackControl(lFileHandle, NET_DVR_PLAYSTART, 0, NULL);
- GetDlgItem(IDC_DOWNLOAD)->SetWindowText("停止下载");
- m_downProgress.SetPos(0);
- m_downProgress.ShowWindow(SW_SHOW);
- m_bDown=TRUE;
- m_staticdownload.Format("正在下载文件%s", filenamedownload);
- GetDlgItem(IDC_STATICSTATE2)->ShowWindow(SW_SHOW);
- SetTimer(DOWNSTATE_TIMER,200,NULL);
- }
- else
- {
- MessageBox("下载文件失败!", "温馨提示", MB_ICONINFORMATION);
-
- CString sTemp;
- sTemp.Format("ERROR: NET_DVR_GetFileByName = %d",NET_DVR_GetLastError());
- TRACE(sTemp);
- return;
- }
- }
- else
- {
- NET_DVR_StopGetFile(lFileHandle);
- m_bDown=FALSE;
- GetDlgItem(IDC_DOWNLOAD)->SetWindowText("下载");
- KillTimer(DOWNSTATE_TIMER);
- Invalidate(TRUE);
- m_downProgress.SetPos(0);
- m_downProgress.ShowWindow(SW_HIDE);
- m_staticdownload.Format("停止下载文件%s", filenamedownload);
- GetDlgItem(IDC_STATICSTATE2)->ShowWindow(SW_HIDE);
- }
- UpdateData(FALSE);
- }
- void CRemoteFilePlay::OnPlayFile()
- {
- // TODO: Add your control notification handler code here
- if(m_nPlayHandle == -1)
- {
- F_Play();
- }
- else
- {
- if(m_bPause)
- {
- if(m_bSetFrame)
- {
- if(NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYNORMAL, 0, NULL))
- {
- m_bSetFrame=FALSE;
- F_SetPlayState();
- }
- }
- if(NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYRESTART, 0, NULL))
- {
- m_bPause=FALSE;
- F_SetPlayState();
- }
- }
- else
- {
- if(m_bSetFrame)
- {
- if(NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYNORMAL, 0, NULL))
- {
- m_bSetFrame=FALSE;
- F_SetPlayState();
- }
- }
- else
- {
- if(NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYPAUSE, 0, NULL))
- {
- m_bPause=TRUE;
- F_SetPauseState();
- }
- }
-
- }
- }
- }
- void CRemoteFilePlay::OnStop()
- {
- // TODO: Add your control notification handler code here
- F_StopPlay();
- }
- void CRemoteFilePlay::OnSlow()
- {
- // TODO: Add your control notification handler code here
- NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYSLOW, 0, NULL);
- }
- void CRemoteFilePlay::OnFast()
- {
- // TODO: Add your control notification handler code here
- NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYFAST, 0, NULL);
- }
- void CRemoteFilePlay::OnCappic()
- {
- // TODO: Add your control notification handler code here
- char cFilename[256];
-
- sprintf(cFilename, "%s\\%d_%d.bmp",ClientParam.m_csPictureSavePath,m_iChannel, GetTickCount());
- if(NET_DVR_PlayBackCaptureFile(m_nPlayHandle,cFilename))
- {
- CString sTemp;
- sTemp.Format("抓图成功 %s!",cFilename);
- MessageBox(sTemp, "温馨提示", MB_ICONINFORMATION);
- return;
- }
- else
- {
- MessageBox("抓图失败!", "温馨提示", MB_ICONINFORMATION);
- }
- }
- void CRemoteFilePlay::OnStep()
- {
- // TODO: Add your control notification handler code here
- if(NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYFRAME, 0, NULL))
- {
- CButton *pButton;
- pButton = (CButton *)GetDlgItem(IDC_PLAY_FILE);
- pButton->SetIcon(m_hPlayEnableIcon);
- pButton->EnableWindow(TRUE);
- m_bSetFrame = TRUE;
- }
- }
- void CRemoteFilePlay::OnSound()
- {
- // TODO: Add your control notification handler code here
- CButton *pButton;
-
- if(m_bSound)
- {
- if(NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYSTOPAUDIO, 0, NULL))
- {
- m_bSound=FALSE;
- pButton = (CButton *)GetDlgItem(IDC_SOUND);
- pButton->SetIcon(m_hSoundStopIcon);
- }
- }
- else
- {
- if(NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYSTARTAUDIO, 0, NULL))
- {
- pButton = (CButton *)GetDlgItem(IDC_SOUND);
- pButton->SetIcon(m_hSoundStartIcon);
- m_bSound=TRUE;
- }
- }
- }
- void CRemoteFilePlay::F_InitUI()
- {
- // 初始化按钮
- CButton *pButton;
-
- m_rcScreen=CRect(0,0,GetSystemMetrics(SM_CXSCREEN),GetSystemMetrics(SM_CYSCREEN));
- //初始化滑动条
- pButton = (CButton *)GetDlgItem(IDC_PLAY_FILE);
- pButton->SetIcon(m_hPlayDisableIcon);
- pButton->EnableWindow(FALSE);
-
- 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_STEP);
- pButton->SetIcon(m_hStepDisableIcon);
- pButton->EnableWindow(FALSE);
-
- pButton = (CButton *)GetDlgItem(IDC_GOTOSTART);
- pButton->SetIcon(m_hGotoHeadDisableIcon);
- 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 CRemoteFilePlay::F_SetStopState()
- {
- CButton *pButton;
-
- m_ctlProgress.SetPos(0);
- m_ctlProgress.EnableWindow(FALSE);
- m_ctlVolume.EnableWindow(FALSE);
-
- pButton = (CButton *)GetDlgItem(IDC_PLAY_FILE);
- 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_STEP);
- pButton->SetIcon(m_hStepDisableIcon);
- pButton->EnableWindow(FALSE);
-
- pButton = (CButton *)GetDlgItem(IDC_GOTOSTART);
- pButton->SetIcon(m_hGotoHeadDisableIcon);
- 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);
-
- pButton = (CButton *)GetDlgItem(IDC_STEP);
- pButton->SetIcon(m_hStepDisableIcon);
- pButton->EnableWindow(FALSE);
- }
- void CRemoteFilePlay::F_Exit()
- {
- if(m_hFileThread)
- {
- TerminateThread(m_hFileThread, 0);
- CloseHandle(m_hFileThread);
- m_hFileThread = NULL;
- NET_DVR_FindClose(m_lFileHandle);
- }
-
- //2008-02-25 这里要调用这个函数逐步停止,不能只调用停止解码
- F_StopPlay();
- Sleep(100);
- }
- void CRemoteFilePlay::F_Play()
- {
- UpdateData(TRUE);
-
- int m_nVerifyret = -1;
- CString csFileName;
- int fileselpos = 0;
- HWND PlayhWnd=m_PlayWnd.GetSafeHwnd();
- POSITION pos = m_Filelist.GetFirstSelectedItemPosition();
- if(pos == NULL)
- {
- MessageBox("请选择要播放的文件!", "温馨提示", MB_ICONINFORMATION);
-
- return;
- }
-
- fileselpos = m_Filelist.GetNextSelectedItem(pos);
- csFileName.Format("%s",m_Filelist.GetItemText(fileselpos,0));
- if(csFileName.IsEmpty())
- return;
- TRACE("远程回放文件:%s \n", csFileName);
- sprintf(filename,"%s",csFileName);
- // remoteplay_info.srcfilename=filename;
- if(m_nPlayHandle>=0)
- {
- NET_DVR_StopPlayBack(m_nPlayHandle);
- m_nPlayHandle = -1;
- Sleep(400);
- }
- m_nPlayHandle = NET_DVR_PlayBackByName(m_lServerID, filename, PlayhWnd);
- if(m_nPlayHandle == -1)
- {
-
- MessageBox("回放失败!", "温馨提示", MB_ICONINFORMATION);
- return;
- }
- NET_DVR_SetPlayDataCallBack(m_nPlayHandle, PlayDataCallBack, m_nPlayHandle);
- F_SetPlayState();
- NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYSTART, 0, NULL);
- if(NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYSTARTAUDIO, 0, NULL))
- {
- m_bSound=TRUE;
- NET_DVR_PlayBackControl(m_nPlayHandle, 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);
- }
- bGetMaxTime = FALSE;
- SetTimer(RPSTATE_TIMER, 1000, NULL);
- }
- void CRemoteFilePlay::F_SetPlayState()
- {
- m_ctlProgress.EnableWindow(TRUE);
- m_ctlVolume.EnableWindow(TRUE);
-
- CButton *pButton;
-
- pButton = (CButton *)GetDlgItem(IDC_PLAY_FILE);
- 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);
-
- pButton = (CButton *)GetDlgItem(IDC_STEP);
- pButton->SetIcon(m_hStepEnableIcon);
- pButton->EnableWindow(TRUE);
-
- pButton = (CButton *)GetDlgItem(IDC_GOTOSTART);
- pButton->SetIcon(m_hGotoHeadEnableIcon);
- pButton->EnableWindow(TRUE);
- }
- void CRemoteFilePlay::F_SetPauseState()
- {
- CButton *pButton;
- pButton = (CButton *)GetDlgItem(IDC_PLAY_FILE);
- pButton->SetIcon(m_hPlayEnableIcon);
- pButton->EnableWindow(TRUE);
- }
- void CRemoteFilePlay::F_StopPlay()
- {
- if(m_bFullScreen)
- {
- m_bFullScreen = FALSE;
- F_ShowNormal();
- }
- if(m_nPlayHandle >= 0)
- {
- if(m_bSaveFile)
- {
- NET_DVR_StopPlayBackSave(m_nPlayHandle);
- m_bSaveFile = FALSE;
- }
- NET_DVR_StopPlayBack(m_nPlayHandle);
- m_nPlayHandle = -1;
- m_ctlProgress.SetPos(0);
- CString csText;
-
- KillTimer(RPSTATE_TIMER);
- csText.Format("%d/%d %02d:%02d:%02d/%02d:%02d:%02d",0,0,0,0,0,0,0,0);
- GetDlgItem(IDC_PLAYSTATUS)->SetWindowText(csText);
- //2008-02-25 停止回放时如果打开了声音就要关闭
- if (m_bSound)
- {
- NET_DVR_PlayBackControl(m_nPlayHandle, NET_DVR_PLAYSTOPAUDIO, 0, NULL);
- m_ctlVolume.SetPos(0);
- ((CButton *)GetDlgItem(IDC_SOUND))->SetIcon(m_hSoundStopIcon);
- m_bSound = FALSE;
- }
- UpdateData(FALSE);
- Invalidate(TRUE);
- }
- m_bPause = FALSE;
- m_bSetFrame = FALSE;
- F_SetStopState();
- }
- void CRemoteFilePlay::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 CRemoteFilePlay::F_EnableFlashWnd(BOOL bEnable)
- {
- if(bEnable)
- {
- //THE same to multiplay
- GetDlgItem(IDC_PLAYSTATUS)->ModifyStyle(0,WS_VISIBLE,0);
- GetDlgItem(IDC_PLAY_FILE)->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_SOUND)->ModifyStyle(0,WS_VISIBLE,0);
- GetDlgItem(IDC_VOLUME_SLIDER)->ModifyStyle(0,WS_VISIBLE,0);
- GetDlgItem(IDC_PROGRESS_SLIDER)->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_COMBOFILETYPE)->ModifyStyle(0,WS_VISIBLE,0);
- GetDlgItem(IDC_SEARCHLIST)->ModifyStyle(0,WS_VISIBLE,0);
- GetDlgItem(IDC_CAPPIC)->ModifyStyle(0,WS_VISIBLE,0);
- //the only for single play
- GetDlgItem(IDC_DOWNLOAD)->ModifyStyle(0,WS_VISIBLE,0);
- GetDlgItem(IDC_REMOTEFILRLIST)->ModifyStyle(0,WS_VISIBLE,0);
- if(m_bDown)
- GetDlgItem(IDC_DOWNPROGRESS)->ModifyStyle(0,WS_VISIBLE,0);
- GetDlgItem(IDC_STEP)->ModifyStyle(0,WS_VISIBLE,0);
- GetDlgItem(IDC_GOTOSTART)->ModifyStyle(0,WS_VISIBLE,0);
- }
- else
- {
- //THE same to multiplay
- GetDlgItem(IDC_PLAYSTATUS)->ModifyStyle(WS_VISIBLE,0,0);
- GetDlgItem(IDC_PLAY_FILE)->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_SOUND)->ModifyStyle(WS_VISIBLE,0,0);
- GetDlgItem(IDC_VOLUME_SLIDER)->ModifyStyle(WS_VISIBLE,0,0);
- GetDlgItem(IDC_PROGRESS_SLIDER)->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_COMBOFILETYPE)->ModifyStyle(WS_VISIBLE,0,0);
- GetDlgItem(IDC_SEARCHLIST)->ModifyStyle(WS_VISIBLE,0,0);
- GetDlgItem(IDC_CAPPIC)->ModifyStyle(WS_VISIBLE,0,0);
- //the only for single play
- GetDlgItem(IDC_REMOTEFILRLIST)->ModifyStyle(WS_VISIBLE,0,0);
- GetDlgItem(IDC_STEP)->ModifyStyle(WS_VISIBLE,0,0);
- GetDlgItem(IDC_GOTOSTART)->ModifyStyle(WS_VISIBLE,0,0);
- GetDlgItem(IDC_DOWNLOAD)->ModifyStyle(WS_VISIBLE,0,0);
- GetDlgItem(IDC_DOWNPROGRESS)->ModifyStyle(WS_VISIBLE,0,0);
- }
- }
- BOOL CRemoteFilePlay::IsInWnd(CPoint point)
- {
- CRect rc;
- GetDlgItem(IDC_WND)->GetWindowRect(&rc);
- ScreenToClient(&rc);
- if(PtInRect(&rc,point))
- return TRUE;
- else
- return FALSE;
- }
- void CRemoteFilePlay::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 CRemoteFilePlay::OnSelchangeComboserver()
- {
- // TODO: Add your control notification handler code here
- iSelServer = m_ServerCtrl.GetCurSel() - 1;
- if(iSelServer < 0)
- return;
- m_lServerID = serverinfo[iSelServer].m_lServerID;
- m_lServerType = serverinfo[iSelServer].m_wServerType;
- m_lStartChan = serverinfo[iSelServer].m_lStartChannel;
- int m_iChanNum = serverinfo[iSelServer].m_iServerChannelNumber;
- m_ChannelCtrl.ResetContent();
- CString sTemp;
- for(int i=0; i<m_iChanNum; i++)
- {
- sTemp.Format("%d", i+m_lStartChan);
- m_ChannelCtrl.AddString(sTemp);
- }
- m_iChannel = 0;
- m_ChannelCtrl.SetCurSel(m_iChannel);
-
- m_FileType.ResetContent();
- if(m_lServerType == ATMDVR) //ATM DVR
- {
- m_FileType.AddString("全部");
- m_FileType.AddString("定时录像");
- m_FileType.AddString("移动侦测");
- m_FileType.AddString("接近报警");
- m_FileType.AddString("出钞报警");
- m_FileType.AddString("进钞报警");
- m_FileType.AddString("命令触发");
- m_FileType.AddString("手动录像");
- m_FileType.AddString("震动报警");
- if (serverinfo[iSelServer].m_dwAlarmInNum == 5)
- {
- m_FileType.AddString("环境触发报警");
- }
- }
- if(m_lServerType == DVR || m_lServerType >= DVR_HC) //DVR
- {
- m_FileType.AddString("全部");
- m_FileType.AddString("定时录像");
- m_FileType.AddString("移动侦测");
- m_FileType.AddString("报警触发");
- m_FileType.AddString("报警|动测");
- m_FileType.AddString("报警&动测");
- m_FileType.AddString("命令触发");
- m_FileType.AddString("手动触发");
- }
- iFileType = 0;
- m_FileType.SetCurSel(iFileType);
- }
- void CRemoteFilePlay::OnCancel()
- {
- // TODO: Add extra cleanup here
-
- //CDialog::OnCancel();
- }
- void CRemoteFilePlay::OnButtonsave()
- {
- // TODO: Add your control notification handler code here
- //zxy 2005-01-04
- static char szFilter[]="All File(*.mp4)|*.*||";
- char m_sFile[256] = "c:\\Savefile.mp4";
- CString csFile;
- CFileDialog dlg(FALSE,"*.mp4","Savefile.mp4",OFN_OVERWRITEPROMPT|OFN_HIDEREADONLY,
- szFilter);
- if(dlg.DoModal()==IDOK)
- {
- csFile = dlg.GetPathName();
- UpdateData(FALSE);
- sprintf(m_sFile, "%s", csFile);
- }
- if(NET_DVR_PlayBackSaveData(m_nPlayHandle, m_sFile))
- {
- m_bSaveFile = TRUE;
- }
- else
- {
-
- MessageBox("文件保存失败!", "温馨提示", MB_ICONINFORMATION);
- }
- }
- void CRemoteFilePlay::OnButtonstopsave()
- {
- // TODO: Add your control notification handler code here
- if(m_bSaveFile)
- {
- NET_DVR_StopPlayBackSave(m_nPlayHandle);
- m_bSaveFile = FALSE;
- MessageBox("停止保存成功!", "温馨提示", MB_ICONINFORMATION);
-
- }
- }
- //zxy 2005-01-04
- /*
- void CRemoteFilePlay::OnButplay()
- {
- // TODO: Add your control notification handler code here
- UpdateData(TRUE);
- int fileselpos = 0;
- CString csFileName;
- POSITION pos = m_Filelist.GetFirstSelectedItemPosition();
- if(pos == NULL)
- {
- }
-
- fileselpos = m_Filelist.GetNextSelectedItem(pos);
- csFileName.Format("%s",m_Filelist.GetItemText(fileselpos,0));
- if(csFileName.IsEmpty())
- return;
- TRACE("远程回放文件:%s \n", csFileName);
- sprintf(filename,"%s",csFileName);
- // if(NET_DVR_PlayBackByNameLocDisplay(m_lServerID, filename))
- {
- TRACE("远程控制本地回放成功!");
- }
- }
- void CRemoteFilePlay::OnButstop()
- {
- // TODO: Add your control notification handler code here
- // if(NET_DVR_StopLocDisplayPlay(m_lServerID))
- {
- TRACE("停止远程控制本地回放成功!");
- }
- }
- */
- void CRemoteFilePlay::OnGotostart()
- {
- // TODO: Add your control notification handler code here
- NET_DVR_PlayBackControl(m_nPlayHandle,NET_DVR_PLAYSETPOS, 0, NULL);
- }
|