Raysefo

Raysefo

  • 1.5k
  • 284
  • 150.2k

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)