winforms - Why can't I use a UI component (Windows form) inside of a Windows service? -


I have seen many posts that essentially indicate that UI components should not run as a service, I think rational I can not answer any UI event etc. But the fact is that there are many automation tasks that are only possible with Windows forms.

Here are some great examples:

  1. I would like to create a URL crawler service that creates thumbnails of webpages. Currently the only way I am looking to get it. The Net Webcam component is to try and automate.

  2. Automate printing of MS-Word docs.

There was some trick to get pre-vista around this, but now there is no one my question is why this is the matter, and what exactly are the options ?

look and

Basically if two processes (for different users) share the same desktop, then a process can potentially execute the code that you want in the second process by sending a Windows message. , And it is called a slap attack.

There were so many discussions about whether this was a design bug, and after Vista, Microsoft decided to remove any interactive desktop support for the services because it was a potential security hole.

> As an alternative, you can view your image generation / printing code as a logged user, which has an interactive desktop access


Comments