C# Screenshot when screen is sleeping

Associate
Joined
18 Oct 2002
Posts
2,092
Location
Edinburgh
I've written an app that grabs parts of the screen from a live feed and saves them as an image. All works fine until the screen sleeps, then the live feed stops working.
If the screen saver is activated i get grabs of the screensaver.

Is there any way of grabbing the screen while the screen is asleep?

Code:
            var screen = Screen.PrimaryScreen;
            using (var bitmap = new Bitmap(200,160))
            using (var graphics = Graphics.FromImage(bitmap))
            {
                graphics.CopyFromScreen(new Point(10, 10), new Point(0, 0), screen.Bounds.Size);
                bitmap.Save("C:\\inetpub\\wwwroot\\Cam1.png", ImageFormat.Png);
            }
 
yeah i know i can stop the monitor sleeping, i just didn't want to stop it.

Is there a way i can copy from underneath the screensaver? or will it stop updating the screen underneath when the screensaver is active?
 
Back
Top Bottom