locked
to add an icon for windows service RRS feed

  • Question

  • Sir...

    How to add an icon for windows service application  in system tray.. Plz help


    Mrs Nishad

    Wednesday, June 3, 2020 10:13 AM

All replies

  • Windows services run in an isolated, non-interactive session.  They cannot display a user interface.  Ordinarily, any child process started by a Windows service will also run in the same non-interactive session and will also not display a user interface.

    If you want to interact with a Windows service from a logged-on user's interactive session then you must start a process in the user's session that communicates with the Windows service using some form of inter-process communication.

    • Proposed as answer by CoolDadTx Wednesday, June 3, 2020 1:23 PM
    Wednesday, June 3, 2020 10:19 AM
  • I think she'll also want to know how to show notification for that formless application.
    Wednesday, June 3, 2020 11:17 AM
    Answerer
  • Another option is to create a Windows form project, implement a NotifyIcon class to have the service operations available and a user interface.

    In the screenshot below the service solution folder has the projects that compose a windows service while the solution folder Win Forms notifier is a windows form project using NotifyIcon, since there is very little code in the actual window service project with the bulk of the operations in class projects this was an easy thing to code. As is, if needed both can run at the same time but only one does.

    The key to this working is how you designed the service code, if everything is in the service project this means a decent amount of code while the opposite will be easy as in my case two hours total.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Wednesday, June 3, 2020 1:58 PM
  • Hi,

    Has your issue been resolved?

    If so, please click "Mark as Answer" for the answer that solved your problem, so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, June 9, 2020 8:32 AM