0

I'm trying to implement screen capturing. I know there are already few solutions on the internet - for example, this Capture screenshot of active window? But that solution is not sufficient. Some of the applications are impossible to capture (when I try to capture the screen the app is automatically minimizing. I don't know why. Maybe it has some kind of protection against screenshotting?). I'm trying to bypass this.

Maybe there is a way to intercept the signal from the GPU? Or read the GPU buffer or something?

Girolamo
  • 17
  • 4
  • You will need to give more detail about the solution that doesn't work; e.g. for which specific applications does it not work and what exact behavior occurs? Basic (free) screen recording software like OBS should have no problem recording any application. – TylerH Mar 22 '21 at 18:53

1 Answers1

2

Try this:

private void CaptureMyScreen()
{

  try

  {

       //Creating a new Bitmap object

      Bitmap captureBitmap = new Bitmap(1024, 768, PixelFormat.Format32bppArgb);

   
     //Bitmap captureBitmap = new Bitmap(int width, int height, PixelFormat);

     //Creating a Rectangle object which will  

     //capture our Current Screen

     Rectangle captureRectangle = Screen.AllScreens[0].Bounds;



     //Creating a New Graphics Object

     Graphics captureGraphics = Graphics.FromImage(captureBitmap);



    //Copying Image from The Screen

    captureGraphics.CopyFromScreen(captureRectangle.Left,captureRectangle.Top,0,0,captureRectangle.Size);



    //Saving the Image File

    captureBitmap.Save(@"E:\Capture.jpg",ImageFormat.Jpeg);


    MessageBox.Show("Screen Captured");

}

catch (Exception ex)

{

    MessageBox.Show(ex.Message);

}
}

This code captures the entire screen.

I haven't tried this, but try checking it out: https://stackoverflow.com/a/54174119/6894842

Osayed
  • 43
  • 6