1

Is it possible to take a screen shot of windows desktop on Login Screen ?

I build a windows service in C# that captures the screen but when logged off a I got the exception with message "The handle is invalid."

I used this code

Bitmap bitmap = new Bitmap(SelectionRectangle.Width, SelectionRectangle.Height);
using (Graphics g = Graphics.FromImage(bitmap))
{
   g.CopyFromScreen(SourcePoint, DestinationPoint, SelectionRectangle.Size);
}

Does using Windows API can solve the problem ?

I am trying to achieve something like Ultra VNC can do.

Patrik
  • 1,286
  • 1
  • 31
  • 64

1 Answers1

0

I think the problem may be that you're on the wrong WindowStation. Have a look at these articles;

Why does print screen in a Windows Service return a black image?

Screen capture from windows service

You may need to enumerate the win-stations and locate the login desktop and use that.

Community
  • 1
  • 1
cirrus
  • 5,624
  • 8
  • 44
  • 62