I've been busy learning windows service these days. I have here a windows service application that monitors a folder then logs all the activities inside that folder. I want my windows service to show in the system tray, how do I integrate my windows service and the notify icon? Thanks! :)

You have to establish some form of communication protocol so that your application running in the systray and your service can talk without being the same thing.

So, I should create a separate project for the notify icon? Or just add a forms application to my windows service app?

You would need a separate application - as a rule a lot of machines are set so that services dont and cant interact with the desktop, as a result the service wont even run if it has forms in it.

Thanks for the reply, you've been very helpful. Uhmm, can I ask you why is it that a lot of machines are set so that services don't and couldn't interact with the desktop? What rule is it? I'm a little confused. Thanks.

Part of it is done because a lot of services are running as a service account that has admin access with no questions and so any "user" who can interact with that potentially has more rights than they should

Other reasons are that because services have no session like a user would, you need to be careful as to who would be controlling something if a service were to appear on more than one session..

I believe by default vista doesnt allow it, and certainly GPOs are applied in a lot of companies/organisations (unis etc) to prevent any exploitation.

I see. I have read that too that windows vista does not allow interaction between the ui and a service. Thanks!

Hey guys,

If any one suggesting to Create a separate application and call the window service from that. then what is the need of window service?

If you want a User interface then go for Window application or else go for Window service.

Thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.