⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 search.cpp

📁 DVR-MPEG4编码播放器
💻 CPP
📖 第 1 页 / 共 2 页
字号:
		strcat(sz_marked,buf);

        strcat(sz_marked,"   ");
        sprintf(buf,"%02d",m_day);
		strcat(sz_marked,buf);
        strcat(sz_marked,"/");
        sprintf(buf,"%02d",m_month);
		strcat(sz_marked,buf);
        strcat(sz_marked,"/");
        sprintf(buf,"%02d",m_year);
		strcat(sz_marked,buf);
        
        strcat(sz_marked,"      ");

		if(m_type==0){
			strcat(sz_marked,"***");}//Marked
		else
			if(m_type==1){
				strcat(sz_marked,"***"); //Alaram
			}
			else
				strcat(sz_marked,"Mpg");
		strcat(sz_marked,"          ");
		
		sprintf(buf,"%02d",m_Camera);
		strcat(sz_marked,buf);
		strcat(sz_marked,"          ");
        
		int m_Duration_min=m_Duration/60;
		int m_Duration_ss=m_Duration%60;
		sprintf(buf,"%02d",m_Duration_min);
		strcat(sz_marked,buf);
		strcat(sz_marked,":");
		sprintf(buf,"%02d",m_Duration_ss);
        strcat(sz_marked,buf);
		
		m_ListBox.AddString(sz_marked);
	}
	Trans_MarkedFile2=Trans_MarkedFile;
	m_List_Flag=4; //Search

}

BOOL CSearch::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	// TODO: Add extra initialization here

	SYSTEMTIME systime;
	
	char buffer[20];
	::GetLocalTime(&systime);
	

	itoa(systime.wYear,buffer,10);
	
	//sprintf(buffer,"%02d",systime.wYear);
    //SetDlgItemText(IDC_EDIT_Start_YYYY,buffer);
	//itoa(systime.wHour,buffer,10);

    sprintf(buffer,"%02d",systime.wHour);
    
	SetDlgItemText(IDC_EDIT_Start_HH,buffer);

    //itoa(systime.wMinute,buffer,10);
    sprintf(buffer,"%02d",systime.wMinute);
    
	SetDlgItemText(IDC_EDIT_Start_MIN,buffer);

	//itoa(systime.wSecond,buffer,10);
    sprintf(buffer,"%02d",systime.wSecond);
    SetDlgItemText(IDC_EDIT_Start_SS,buffer);

	//CWnd* pWnd_YYYY = GetDlgItem( IDC_EDIT_Start_YYYY );
    CWnd* pWnd_SS = GetDlgItem( IDC_EDIT_Start_SS );
	CWnd* pWnd_HH = GetDlgItem( IDC_EDIT_Start_HH );
	CWnd* pWnd_MIN = GetDlgItem( IDC_EDIT_Start_MIN );

	CMp4PlayerApp *playip = (CMp4PlayerApp *)::AfxGetApp();
	playip->GetConnectIPAddress(ConnectIP,&ConnectPort);
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}

void CSearch::OnPlay() 
{

	CString getstr;
	char cmd[1];
	TRANS_FILE m_PlaySelectFileName;
	int rtn = 0;
    ::memset(&m_PlaySelectFileName,0,sizeof(m_PlaySelectFileName));
	if(m_ListBox.GetSelCount()<=0)
	{
		::AfxMessageBox("Error!");
		return;
	}
    m_PlaySelectFileName.FileCounter=m_ListBox.GetSelCount();

	int delindex=0;
	int arry_del[256];
    for(int i=0;i< m_ListBox.GetCount();i++)
	{
		if(m_ListBox.GetSel(i)>0)
		{
			strcpy(m_PlaySelectFileName.Buf_File[delindex].FileName,Trans_MarkedFile2.T_Search[i].T_File.FileName);
			arry_del[delindex]=i;
			delindex++;
		}
	}

	if(m_Remote)
	{

		InitVRTLink(ConnectIP,ConnectPort);
		cmd[0]=VRTPlay;
		SendVRTData(cmd,1);
		Sleep(1);
		SendVRTData((char *)&m_PlaySelectFileName,sizeof(TRANS_FILE));
		CloseVRTLink();
	}
	if(m_Local)
	{
		RECT rc;
		HWND hWnd =::GetDlgItem(::AfxGetMainWnd()->m_hWnd,IDC_WIN);
		::GetClientRect(hWnd,&rc); 


		CMp4PlayerApp *play = (CMp4PlayerApp *)::AfxGetApp();
		SearchPlay = play->GetPlayStatus(); 
	
		if(SearchPlay == true)
		{
			StopPlay();
			SearchPlay = false;
			play->SetPlayStatus(SearchPlay);

		}

		if(!SearchPlay)	
			InitPlay();
	
		IfDeInterlace(TRUE);
		memset(&Trans_File3,0,sizeof(TRANS_FILE3));
	
		Trans_File3.FileCounter =m_PlaySelectFileName.FileCounter;
		for(int n=0;n<Trans_File3.FileCounter;n++)
		{
			GetPath(Trans_File3.Buf_File[n].FileName,m_PlaySelectFileName.Buf_File[n].FileName);
			Trans_File3.Buf_File[n].FileLen = 0;
		}
		SendFile((char *)&Trans_File3); 
		StartPlay(NULL,IFPLAYER, hWnd,rc); 
	
		SearchPlay = true;
		play->SetPlayStatus(SearchPlay);
	}
}

void CSearch::OnDblclkList1() 
{

	CString getstr;
	TRANS_FILE m_PlaySelectFileName;
	char  cmd[1];
    // HWND hWnd;
    // RECT rc ;
	int Play_index;
	int count;
	int rtn = 0;
    bool status = 0; 
			
	count=Trans_MarkedFile2.Total;
	Play_index=m_ListBox.GetCurSel();
	if(Play_index<0)
	{
		m_ListBox.ResetContent();
		m_ListBox.AddString("Error!");
		return;
	}
	::memset(&m_PlaySelectFileName,0,sizeof(TRANS_FILE));

	m_PlaySelectFileName.FileCounter=1;
	strcpy(m_PlaySelectFileName.Buf_File[0].FileName,Trans_MarkedFile2.T_Search[Play_index].T_File.FileName);
    
	//InitVRTLink("192.168.0.20",2003);
	if(m_Remote)
	{
		InitVRTLink(ConnectIP,ConnectPort);
		cmd[0]=VRTPlay;
		SendVRTData(cmd,1);
		Sleep(1);
		SendVRTData((char *)&m_PlaySelectFileName,sizeof(TRANS_FILE));
		CloseVRTLink();
	}
	if(m_Local)
	{
		RECT rc;
		HWND hWnd =::GetDlgItem(::AfxGetMainWnd()->m_hWnd,IDC_WIN);
		::GetClientRect(hWnd,&rc); 
	
		CMp4PlayerApp *play = (CMp4PlayerApp *)::AfxGetApp();
		SearchPlay = play->GetPlayStatus(); 
	
		if(SearchPlay == true)
		{
			StopPlay();
			SearchPlay = false;
			play->SetPlayStatus(SearchPlay);

		}

		if(!SearchPlay)	
			InitPlay();

		IfDeInterlace(TRUE);
		memset(&Trans_File3,0,sizeof(TRANS_FILE3));
	
		Trans_File3.FileCounter =m_PlaySelectFileName.FileCounter;
		for(int n=0;n<Trans_File3.FileCounter;n++)
		{
			GetPath(Trans_File3.Buf_File[n].FileName,m_PlaySelectFileName.Buf_File[n].FileName);
			Trans_File3.Buf_File[n].FileLen = 0;
		}
		SendFile((char *)&Trans_File3); 
		StartPlay(NULL,IFPLAYER, hWnd,rc); 
	
		SearchPlay = true;
		play->SetPlayStatus(SearchPlay);
	}
}

void CSearch::OnDeleteFile() 
{
	// TODO: Add your control notification handler code here
	CString getstr;
	char cmd[1];
	TRANS_FILE m_PlaySelectFileName;
	
	memset(&m_PlaySelectFileName,0,sizeof(m_PlaySelectFileName));
    m_PlaySelectFileName.FileCounter=m_ListBox.GetSelCount();
	
	if(m_PlaySelectFileName.FileCounter<=0)
	{
		return;
	}
	int delindex=0;
	int arry_del[256];
    for(int i=0;i< m_ListBox.GetCount();i++)
	{
		if(m_ListBox.GetSel(i)>0)
		{
		
			strcpy(m_PlaySelectFileName.Buf_File[delindex].FileName,Trans_MarkedFile2.T_Search[i].T_File.FileName);
			arry_del[delindex]=i;
			delindex++;
			
		}
	}
    for(i=0;i<m_ListBox.GetSelCount();i++)
	{
		m_ListBox.DeleteString(arry_del[i]);
	}

	//InitVRTLink("192.168.0.20",2003);
	InitVRTLink(ConnectIP,ConnectPort);
	cmd[0]=VRTDeleteFile;
	SendVRTData(cmd,1);
	Sleep(1);
	SendVRTData((char *)&m_PlaySelectFileName,sizeof(TRANS_FILE));
	CloseVRTLink();

	if(m_List_Flag==3)
	{
		OnListtoday();
		OnListtoday();
	}
	if(m_List_Flag==3)
	{
		OnSearch();		
		OnSearch();		
	}
}

void  CSearch::GetPath(char *DestPath,char *SourcePath)
{
	char FileName[80];
	char Path[80];
	char buf[80];
	int i=0;
	int m=0;
	int n=0;
	char *p;
	memset(Path,0,sizeof(Path));
	strcpy(FileName,SourcePath);
	p = FileName;

	while(p[i]!=NULL)
	{
		if(p[i] == '/')
		{
			m++;
			if(m>3)
			{
				Path[n] = '\\';
				n++;
			}
		}
		if((m>3) && (p[i] !='/'))
		{
			Path[n] = p[i];  
			n++;
		}
		i++;
	}
	
	sprintf(buf,"\\\\%s\\KaiFaTech",ConnectIP);
	//strcpy(buf,"\\\\192.168.0.20\\mpg");KaiFaTech
	strcat(buf,Path);
	strcpy(DestPath,buf);
}

void CSearch::OnLocal() 
{
	m_Local = !m_Local;
}

void CSearch::OnRemote() 
{
	m_Remote = !m_Remote;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -