2

I created an application that captures the current screen and uses it as the background image of the form. The application works normally within Visual Studio, also when I run it bycompiled exe and also when the exe is renamed to scr. However when I install the scr file as is my default screen saver (File Context Menu -> Install), the captured screen is always the desktop, never the windows that are active in the foreground.

   private void Form1_Load(object sender, EventArgs e)
    {
        this.Location = new System.Drawing.Point(0, 0);
        this.Size = new System.Drawing.Size(3200, 900);

        var tela = new Bitmap(3200, 900, PixelFormat.Format32bppArgb);
        var imagem = Graphics.FromImage(tela);

        imagem.CopyFromScreen(0, 0, 0, 0, this.Size,
                                    CopyPixelOperation.SourceCopy);

        tela.Save("tela.png", ImageFormat.Png);

        this.BackgroundImage = new Bitmap("tela.png");
    }
  • 1
    Do you have some [code to show](http://stackoverflow.com/help/mcve)? Kind of hard to help when all that we have is "I want my app to do X but it's doing Y." – techturtle Dec 22 '16 at 15:02
  • 1
    Edit your answer and put the code in there. Click the `?` button on the editor for help with formatting the code in your answer. – techturtle Dec 22 '16 at 15:42
  • I Have the same problem. I haven't solved it yet, but I think this is the way to go: https://stackoverflow.com/questions/38752939/execute-program-capturing-screenshots-from-windows-service/45095509#45095509 – MundoPeter Jan 14 '23 at 23:55

0 Answers0