views:

15

answers:

1

Hi I have a windows service application running on users local computers. I also have a application updater app which is invoked by the service to check if there are any latest updates avaliable. If there are then I would like to pop up a notification on the task bar to notify the user that there are updates avaliable. The user can click on the the notify icon and start the update process which will stop the service, install the updates and restart the app.

My question is how can I get the notify icon to appear on the desktop. I tried to get the updater to pop up the icon but since the windows service starts the updater, the updater runs under System user and hence cannot open UIs. Can anybody suggest a solution please

A: 

You don't mention what language you're using to develop your app, so the answer may vary slightly. Basically, Windows Services cannot interact with the logged in user directly, since they run in a different WindowStation. This page on MSDN describes some common techniques to achieve UI interaction from a Windows Service; most of them involve calling non-manage code.

In particular, I suggest you call CreateProcessAsUser from your service to launch a separate app that runs in the user context and displays the icon on the notify area. If your UI app needs to exchange information with the running service, you will need to implement some kind of IPC such as named pipes.

CesarGon
I am using .Net C#
Amitesh
In that case, you can call CreateProcessAsUser using P/Invoke and do as I describe above. It should work.
CesarGon