@@ -534,20 +534,26 @@ bool CCamera::CaptureFrame(const CRect& rectView)
534
534
535
535
// HIER_BEN_IK
536
536
537
+ // UNDER CONSTRUCTION...
537
538
// == REMEMBER ======================================
538
539
// Topleft position on screen is 0:0 not 1:1
539
540
// Hence, Maxscreen size is logical size (e.g. 1650). Last pos is than 1650 minus 1
540
541
// Width = right - left + 1
541
542
// Height = bottom - top - 1
542
543
// ==================================================
543
544
// Conclusion (for our Camstudio application) Weight and Height are one to low here..!
544
- // But where is the cause ???
545
+ // But where is this caused ???
545
546
// ///////////////////////////////////////////
546
547
TRACE ( _T (" ## CCamera::CaptureFrame m_rectView.Width()=%d\n " ), m_rectView.Width () );
547
548
548
549
m_rectFrame = CRect (0 , 0 , m_rectView.Width (), m_rectView.Height ());
549
550
// setup DC's
550
- CDC* pScreenDC = CDC::FromHandle (::GetDC (0 ));
551
+ // CDC* pScreenDC = CDC::FromHandle(::GetDC(0));
552
+
553
+ // Applied bug fix, tracker ID: 3075791 / memory leak, reported and solved by mlt_msk, hScreenDC is released afterwards.
554
+ HDC hScreenDC = ::GetDC (0 );
555
+ CDC* pScreenDC = CDC::FromHandle (hScreenDC);
556
+
551
557
CDC cMemDC;
552
558
cMemDC.CreateCompatibleDC (pScreenDC);
553
559
CBitmap cBitmap;
@@ -579,6 +585,7 @@ bool CCamera::CaptureFrame(const CRect& rectView)
579
585
// m_cImage.GrayScale();
580
586
581
587
++m_uFrameCount;
588
+ ReleaseDC (0 ,hScreenDC);
582
589
583
590
return true ;
584
591
}
0 commit comments