Am taking screenshot of a particular window(hwnd) using PrintWindow API. This works absolutely fine, it takes screenshot of entire window. My question is : My window height is 742 & width is 653. If i want to take the screenshot somewhere in the middle of the window ( Not from the 0,0 ). How would i specify the x & y axis in PrintWindow. My snipnet code looks like this:
void Screenshot()
{
CImage image;
image.Create(imageWidth, imageHeight, 24);
CImageDC imageDC(image);
HWND hwnd = ::FindWindow(0,"EIML");
PrintWindow(hwnd, imageDC, PW_CLIENTONLY);
image.Save("H:\\out.jpg",ImageFormatJPEG);
}
I've tried the alternative methods like BitBlt & StretchBlt where we have an option to specify the x & y axis. But for my project time efficiency is very very important. When i tried with BitBlt & StretchBlt time efficiency is around 25ms. But when i take the screenshot with PrintWindow its time efficiency is 6~8ms. So this would be very suitable to my project.
But PrintWindow API always captures the window image from (0,0). Can someone tellme/suggest me how to take the screenshot of the window at specified location say at x=20 & y=30.
Thank you.