📄 dlgwatchvideo.cpp
字号:
// DlgWatchVideo.cpp : implementation file
//
#include "stdafx.h"
#include "videocapture.h"
#include "DlgWatchVideo.h"
#include "VideoCaptureView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDlgWatchVideo dialog
CDlgWatchVideo::CDlgWatchVideo(CWnd* pParent /*=NULL*/)
: CDialog(CDlgWatchVideo::IDD, pParent)
{
//{{AFX_DATA_INIT(CDlgWatchVideo)
pImage=new byte[768*586*3*54];
m_nChanel=2;
m_sChanel = _T("");
//}}AFX_DATA_INIT
}
void CDlgWatchVideo::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDlgWatchVideo)
// DDX_CBString(pDX, IDC_COMBO1, m_sChanel);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDlgWatchVideo, CDialog)
//{{AFX_MSG_MAP(CDlgWatchVideo)
ON_WM_TIMER()
ON_BN_CLICKED(IDC_OK, On_Ok)
ON_WM_DESTROY()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDlgWatchVideo message handlers
void CDlgWatchVideo::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
CVideoCaptureView *pView=CVideoCaptureView ::GetView();
CRect rect;
if (!pView->m_VC.IsRecording()) {
int *iResult=pView->m_VC.Capture(pImage,m_nChanel,true,10);
if (iResult) {
//GetDlgItem(IDC_VIDEO)->GetWindowRect(&rect);
//ScreenToClient(&rect);
rect=pView->rectVideo;
CDC *pDC=GetDC();
pView->m_VC.DrawImage(pImage,pDC->m_hDC,rect.left+5,rect.top+10,rect.Width()-10,rect.Height()-15);
ReleaseDC(pDC);
}
}
CDialog::OnTimer(nIDEvent);
}
BOOL CDlgWatchVideo::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
// memset(m_pOldImage,0,768*576*3+54);
((CComboBox *)GetDlgItem(IDC_COMBO1))->AddString("1");
((CComboBox *)GetDlgItem(IDC_COMBO1))->AddString("2");
((CComboBox *)GetDlgItem(IDC_COMBO1))->AddString("3");
((CComboBox *)GetDlgItem(IDC_COMBO1))->AddString("4");
m_sChanel.Format("%d",m_nChanel);
int i=((CComboBox *)GetDlgItem(IDC_COMBO1))->FindString(0,_T(m_sChanel));//(0, m_sChanel);
((CComboBox *)GetDlgItem(IDC_COMBO1))->SelectString(i,m_sChanel.GetBuffer(0));
SetTimer(99999,100,0);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDlgWatchVideo::OnOK()
{
DestroyWindow();
}
void CDlgWatchVideo::On_Ok()
{
// TODO: Add your control notification handler code here
// UpdateData(true);
GetDlgItem(IDC_COMBO1)->GetWindowText(m_sChanel);
if (m_sChanel.GetLength()>0) {
m_nChanel=atoi(m_sChanel);
}
}
void CDlgWatchVideo::OnDestroy()
{
CDialog::OnDestroy();
// TODO: Add your message handler code here
delete[] pImage;
CVideoCaptureView *pView=CVideoCaptureView ::GetView();
pView->SetWindowEnable(IDC_BTNSHOWVEDIO,true);
pView->SetWindowEnable(IDC_BTNVIDEOCAP,true);
pView->m_bShowVideo=true;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -