How can I show a Notification Area Balloon and Icon from a Windows Service?

后端 未结 3 1568
攒了一身酷
攒了一身酷 2021-01-03 00:49

I have a Windows Service that is always running when the user starts their workstation. This Windows Service is critical and I would like to show a Balloon Notification in t

3条回答
  •  爱一瞬间的悲伤
    2021-01-03 01:24

    If you just want to send a simple command to your Windows service you can send it a message from your user app in the following way.

    ServiceController myService = new ServiceController("YOUR Service Name");
    myService.ExecuteCommand(123); // do something;
    

    If you override the OnCustomCommand method in you class the extends ServiceBase. You could then use this command to trigger the service to do somthing like reload a config file, or switch to some state.

提交回复
热议问题