none
Starting a form in a service.How Can I do it? RRS feed

  • Question

  • I have the following task.

    When user starts Windows
     Start A windows Service
     Service Starts a form with  some setting details and place in the system tray.


    Any suggestions how I could do that.
    I know how to set up a windows service but I have never started a form from it and put in the system tray.

    Any link,suggestions/things to be aware of?

    Thanks a lot


    Thanks for your help
    Friday, January 15, 2010 3:41 PM

Answers

  • Well, the check box for this in the Control Panel still exists.

    Vista has a feature where it can switch to a separate desktop for your service when your service wants to display something to the user.  Note that this would be very awkward, and I don't know whether it alleviates all of the security concerns nor whether it will continue to be available in future versions of Windows.  I would not recommend pursuing this direction.

    The following shows how this separate desktop works in Vista:

    http://blogs.technet.com/richard_macdonald/archive/2007/06/27/1375523.aspx

    • Marked as answer by devBrix Saturday, January 16, 2010 4:18 PM
    Saturday, January 16, 2010 3:34 PM

All replies

  • This used to be very possible, but was never a good idea.  As of Windows Vista, due to security concerns, you cannot do this.

    Consider separating your application into a frontend that runs as an ordinary GUI application (such as one that uses the tray) and a backend which runs as a service which does the actual processing.

    Use an interprocess communication mechanism such as Windows Communication Foundsation (WCF), remoting, or sockets so that the frontend and the backend can talk to each other.

    Starting the backend is easy since it is a service.  To start the frotend automatically when the user logs in, add it to the user's Startup menu or to the Run registry key (http://msdn.microsoft.com/en-us/library/aa376977(VS.85).aspx).

    Also see this page http://msdn.microsoft.com/en-us/library/ms683502(VS.85).aspx for more information about this issue and Microsoft's recommendations concerning it.
    Friday, January 15, 2010 11:38 PM
  • Thanks for your reply.

    Are you saying that with Vista/Windows 7 is not longer possible to use the "Interact with desktop" feature?
    So the only thing I could do is start the service and have a separate app that when is launched it adds to the start up menu.

    Thanks a lot
    Thanks for your help
    Saturday, January 16, 2010 6:53 AM
  • Well, the check box for this in the Control Panel still exists.

    Vista has a feature where it can switch to a separate desktop for your service when your service wants to display something to the user.  Note that this would be very awkward, and I don't know whether it alleviates all of the security concerns nor whether it will continue to be available in future versions of Windows.  I would not recommend pursuing this direction.

    The following shows how this separate desktop works in Vista:

    http://blogs.technet.com/richard_macdonald/archive/2007/06/27/1375523.aspx

    • Marked as answer by devBrix Saturday, January 16, 2010 4:18 PM
    Saturday, January 16, 2010 3:34 PM
  • Thanks for your help. I have a better idea now.

    Thanks for your help
    Saturday, January 16, 2010 4:18 PM