I have a small application that takes screen shots and saves them to the folder its in. It works fine most of the time, but in some cases, for example while in Team Fortress 2 or while running Warcraft 3 in OpenGL mode it just returns a totally black(or white) image. Does anyone have a way to fix this?
I am using the c# standard:
Bitmap bmp;
Graphics gfx;
bmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
gfx = Graphics.FromImage(bmpScreenshot);
gfx.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
bmpScreenshot.Save("image.jpg", ImageFormat.Jpeg);