Bonjour,
J'ai fait des captures d'écran avec C# dans une application windows qui marche bien. Mais quand je cherche à transformer en service windows, le service tourne, mais bloque sur CopyFromScreen().
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
 
        public Bitmap CapturerBureauWindows()
        {
            Bitmap bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
            Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot);
            bmpScreenshot.Save(@activeDir + "\\" + "img_0.png", ImageFormat.Png);
            gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
            bmpScreenshot.Save(@activeDir + "\\" + "img_1.png", ImageFormat.Png);
 
            return bmpScreenshot;
        }
L'image img_0.png est bien vide, mais jamais d'image img_1.png.
Une idée du pb ?

Merci bien