Hello, for the C# project I am working on I need to get screenshots of all the open windows (like the window thumbnails in the taskbar, but full size). It must also get images from windows that are not on the visible screen area (half/all of the window is off the screen).
Please don't reply with, graphics.copyfromscreen(), because it does not return parts of the window that are off the screen.
Does anyone know how I can do this?
If anyone has an idea, please post some demo code, or a place that i can find some demo code.
(running Windows 7 Home, with Microsoft Visual C# 2010 Express)
K AndrewsPosted Nov 19, 2014, 12:31 AM
This does not do what I need. I need a way of getting screenshots of a given window (by handle), not the screen. This answer also does not return parts of windows that are off of the screen.
Vasu GadhiyaPosted Nov 19, 2014, 12:17 AM
{
Rectangle bounds = this.Bounds;
using (Bitmap bmpScreenCapture = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height))
{
using (Graphics g = Graphics.FromImage(bmpScreenCapture))
{
g.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, bmpScreenCapture.Size, CopyPixelOperation.SourceCopy);
}
bmpScreenCapture.Save(savepath, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
----------------------
Use this Function.