Raysefo

Raysefo

  • 1.4k
  • 284
  • 148.7k

Screen Capture Problem?

Jan 6 2012 8:26 AM
Hi,

I am screen capturing as follows:

Bitmap b = new Bitmap(ScreenWidth, ScreenHeight);             g = Graphics.FromImage(b);             g.CopyFromScreen(Point.Empty, Point.Empty, Screen.PrimaryScreen.Bounds.Size);               b.Save(@"S:\\shot" + i.ToString() + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);             i = i + 1;

The problem is when I lock the computer, it gives The handle is invalid exception for the line below:

g.CopyFromScreen(Point.Empty, Point.Empty, Screen.PrimaryScreen.Bounds.Size);
How can I fix this?

Best Regards.




 

Answers (3)