Unable to capture Desktop Continously
Hi,
I m trying to caputre Desktop continuously so i m using following
code which call after fixed interval of time.
But i m suprised to see i works for some time after that no screen
caputre occured .
Can u Please suggest where i m going wrong.As its work for some time
CDC ScreenDC;
CBitmap Capture;
if(ScreenDC.Attach(::GetDC(NULL)))
{
CSize Dimensions(GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics
(SM_CYSCREEN));
Capture.CreateCompatibleBitmap(&ScreenDC, Dimensions.cx,
Dimensions.cy);//)
CDC MemDC;
//ScreenDC.StretchBlt(0, 0, 800,600, &ScreenDC, 0, 0,GetSystemMetrics
(SM_CXSCREEN) ,GetSystemMetrics(SM_CYSCREEN),SRCCOPY);
MemDC.CreateCompatibleDC(&ScreenDC);
CBitmap *OldBitmap = MemDC.SelectObject(&Capture);
MemDC.BitBlt(0, 0, Dimensions.cx,Dimensions.cy, &ScreenDC, 0, 0,
SRCCOPY);
CImage m2;
m2.Attach(Capture);
//m2.Save(fd.GetPathName());
m2.Save(_T("Image1.gif"),Gdiplus::ImageFormatGIF);//ImageFormatJPEG
m2.Detach();
}
ScreenDC.Detach();
Thanks in Advance