Screen capture does not work in Windows Service...?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi guys,

I have a little problem. I have a class that uses Windows API to capture a
snapshot of the screen. I have this class in a library that I include in my
projects.

When I try to use this class in a windows service, the snapshot comes up as
a black screen. Any idea why? or how do I get around it?

The class works fine if I use it in a regular windows forms application.

Thank you in advance!
 
Windows services do not interact with the desktop. There is a setting in
the properties for the windows service that allows the service to interact
with the desktop. Try changing this setting. I have not done this before,
but it is a thought.
 
Thank you Peter. This is a good lead. However, I cannot find this setting
anywhere. Can you be more specific?

Thank you!
 
1) Administrative Tools --> Services
2) Locate your service and right-click. Select the Properties command.
3) Click the Log On tab.
4) Check the Allow service to interact with desktop checkbox.

I don't know if this will work, but it is worth a try.
 
But what screen are you trying to capture? If no one is logged on,
then all you might get would be the logon screen?

Perhaps your windows service could detect when a user logged on and
when they did, then kick off a thread or process that would capture the
screen.
 
Back
Top