4

Possible Duplicate:
Screenshot of process under Windows Service

I am attempting to more or less emulate Infopath Form Services. So I want to be able to approve or disapprove forms via mobile devices (users will be notified via email). I have the ability to approve/disapprove forms, but the problem is that I need the ability to take screen shots of my program for detailed error reporting (in case something goes wrong during the approval process) (the screen shot process is implemented already). I need the ability to run the program on the server without any user logged in. That is where the problem comes in. If I run my program as a service, I dont get an interactive window, but I get the ability to have my program always run. So I need to be able to launch the program when the computer boots, and have it be able to screenshot itself.

Is there any way to have a windows service have an interactive window at boot, even if its drawn off screen and can never been seen by users, or a way to emulate/fake a window to my program so it can screenshot itself without actually needing an interactive window?

Also, my program is written on the .NET framework in c#

Community
  • 1
  • 1
  • The screenshot method works, that is I have the ability to capture my window and save it to a file. The problem arises because I need to be able to run this program when no user is logged in, so I can't display a window. So I need to find a way to run a GUI program as a service that has the ability to access its own GUI, or a different way of making my program always run. – user1324855 Apr 10 '12 at 19:17
  • 4
    See http://stackoverflow.com/questions/1445788/screenshot-of-process-under-windows-service – Gabe Apr 10 '12 at 19:21
  • 1
    If the program isn't supposed to have a GUI during normal operation, why would you take a screenshot of it? Ever? Just collect the information that you would display on the screen as text for error reporting. – Matt Burland Apr 10 '12 at 19:23
  • It currently has a GUI and it does need it (I need the ability to open an infopath form and take a screenshot of it), so I need the GUI. But I also need the program to always be running, whether a user is logged in or not. I had read the post Gabe linked to but it didn't answer my question as I would the GUI part to run even without a user logged in. So to have the GUI part start when a user logs in wont work. – user1324855 Apr 10 '12 at 19:26

1 Answers1

0

In addition to the fact the service have no desktop to render...

We did not implement rendering of InfoPath forms on the server the way you try because it simply will not work correctly. You can cheat for some time, but running an Office application in headless service mode on a server is simply bad idea. You will also run into interesting issues because user's identity will not match process identity (i.e. can't query ACL'ed data).

You options:

  • Drop InfoPath portion if you just need approval.
  • Go with existing solution for mobile forms. There is some support for mobile forms in Forms Services, and you can have very simple views specially for mobile devices if it works. There are also existing solutions for mobile rendering of InfoPath forms.
  • honestly implement rendering of forms. The XSN format is documented...
  • Render InfoPath on separate machines with logged on user one per user at a time...
Alexei Levenkov
  • 98,904
  • 14
  • 127
  • 179