如何使用C#放置Windows服务的托盘图标 [英] How to place aTray Icon for Windows Service using C#

查看:190
本文介绍了如何使用C#放置Windows服务的托盘图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我必须为Windows服务创建一个托盘图标.
在该服务中,我正在检查文件夹中的某些文件,并将这些文件上传到服务器.
如果上传成功或失败,我必须在任务栏图标中显示气球消息

是否可以在.net 4中使用C#?
在此先感谢您的帮助...

Hi,
I''ve to create a tray icon for windows service.
In that service i am checking for certain files in a folder and uploading that files into a server.
I''ve to show the balloon messages in the tray icon if the upload success or not

Is it possible using C# in .net 4?
Thanks in advance for any help...

推荐答案

请看下面的Question-Answer线程.

http://social.msdn.microsoft.com/Forums/eu/netfxnetcom/thread/d48dcb86-c9c3-4f8a-bafe-041770a7f597
Have a look at below Question-Answer thread.

http://social.msdn.microsoft.com/Forums/eu/netfxnetcom/thread/d48dcb86-c9c3-4f8a-bafe-041770a7f597


服务无法*提供图形用户界面.您需要做的是编写一个普通应用程序,该应用程序位于任务栏中,并与您的服务进行通信.进行跨进程通信的方法多种多样,请选择一种您喜欢使用的方法.我通常查看TCP,但是当服务启动侦听服务器时,它可能会产生防火墙警告消息.

*-好的,从技术上讲是可行的,但这很困难并且违反服务原则,因此您不应该这样做.
A service can''t* provide a graphical UI. What you need to do is write a normal application which sits in the taskbar, and communicates with your service. There''s various methods for doing cross-process communication, pick one which you like using. I generally look at TCP but that might produce a firewall warning message when the service starts a listening server.

* - ok, it is technically possible, but it is hard and against the principles of services so you shouldn''t.


这篇关于如何使用C#放置Windows服务的托盘图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆