VideoCaptureView.cpp
上传用户:czshopping
上传日期:2022-05-22
资源大小:5430k
文件大小:3k
源码类别:

视频捕捉/采集

开发平台:

Visual C++

  1. // VideoCaptureView.cpp : implementation of the CVideoCaptureView class
  2. //
  3. #include "stdafx.h"
  4. #include "VideoCapture.h"
  5. #include"MainFrm.h"
  6. #include "VideoCaptureDoc.h"
  7. #include "VideoCaptureView.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // CVideoCaptureView
  15. IMPLEMENT_DYNCREATE(CVideoCaptureView, CView)
  16. BEGIN_MESSAGE_MAP(CVideoCaptureView, CView)
  17. //{{AFX_MSG_MAP(CVideoCaptureView)
  18. // NOTE - the ClassWizard will add and remove mapping macros here.
  19. //    DO NOT EDIT what you see in these blocks of generated code!
  20. //}}AFX_MSG_MAP
  21. // Standard printing commands
  22. ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
  23. ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
  24. ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
  25. END_MESSAGE_MAP()
  26. /////////////////////////////////////////////////////////////////////////////
  27. // CVideoCaptureView construction/destruction
  28. CVideoCaptureView::CVideoCaptureView()
  29. {
  30. // TODO: add construction code here
  31. m_hdd=DrawDibOpen();
  32. }
  33. CVideoCaptureView::~CVideoCaptureView()
  34. {
  35. DrawDibClose(m_hdd);
  36. }
  37. BOOL CVideoCaptureView::PreCreateWindow(CREATESTRUCT& cs)
  38. {
  39. // TODO: Modify the Window class or styles here by modifying
  40. //  the CREATESTRUCT cs
  41. return CView::PreCreateWindow(cs);
  42. }
  43. /////////////////////////////////////////////////////////////////////////////
  44. // CVideoCaptureView drawing
  45. void CVideoCaptureView::OnDraw(CDC* pDC)
  46. {
  47. CVideoCaptureDoc* pDoc = GetDocument();
  48. ASSERT_VALID(pDoc);
  49. // TODO: add draw code for native data here
  50. RECT rect;
  51. GetClientRect(&rect);
  52. DrawDibDraw(m_hdd,pDC->GetSafeHdc(),rect.left,rect.top,rect.right,rect.bottom,&(((CMainFrame *)AfxGetMainWnd())->m_dibinfo.bitmapheader),NULL,0,0,-1,-1,0);
  53.  }
  54. /////////////////////////////////////////////////////////////////////////////
  55. // CVideoCaptureView printing
  56. BOOL CVideoCaptureView::OnPreparePrinting(CPrintInfo* pInfo)
  57. {
  58. // default preparation
  59. return DoPreparePrinting(pInfo);
  60. }
  61. void CVideoCaptureView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  62. {
  63. // TODO: add extra initialization before printing
  64. }
  65. void CVideoCaptureView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
  66. {
  67. // TODO: add cleanup after printing
  68. }
  69. /////////////////////////////////////////////////////////////////////////////
  70. // CVideoCaptureView diagnostics
  71. #ifdef _DEBUG
  72. void CVideoCaptureView::AssertValid() const
  73. {
  74. CView::AssertValid();
  75. }
  76. void CVideoCaptureView::Dump(CDumpContext& dc) const
  77. {
  78. CView::Dump(dc);
  79. }
  80. CVideoCaptureDoc* CVideoCaptureView::GetDocument() // non-debug version is inline
  81. {
  82. ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CVideoCaptureDoc)));
  83. return (CVideoCaptureDoc*)m_pDocument;
  84. }
  85. #endif //_DEBUG
  86. /////////////////////////////////////////////////////////////////////////////
  87. // CVideoCaptureView message handlers