Is there a more efficient way of getting a copy of the windows desktop ( using GDI or any other library ) than the code below
HDC dcDesktop;
HDC dcMem;
HBITMAP hbmpMem;
HBITMAP hOriginal;
BITMAP bmpDesktopCopy;
dcDesktop = GetDC( GetDesktopWindow() );
dcMem = CreateCompatibleDC( dcDesktop );
hbmpMem = CreateCompatibleBitmap( dcMem, m_lWidth, m_lHeight );
BitBlt( dcMem, 0, 0, m_lWidth, m_lHeight, dcDesktop, 0, 0, SRCCOPY );
// Copy the hbmpMem to the desktop copy
GetObject(hbmpMem, sizeof(BITMAP), (LPSTR)&bmpDesktopCopy);
See Question&Answers more detail:os