Question

Is it possible to create a tray icon from a Delphi service application under Windows Vista or later?

Was it helpful?

Solution

No it is not. Services run in session 0. Your interactive processes, your desktop, all run in a different session, one per logged on user.

This isolation is important and is designed to enhance security. Even in Windows XP you were not meant to have direct interaction between services and the desktop. Developers all did it anyway so Microsoft banned it in Vista.

Standard practice is to create the tray icon process by some other means, e.g. HKLM\Software...\Run. That interactive process can then communicate with the service using IPC. For example named pipes.

Now, it is technically possible, in some extremely limited situations for a service to launch a process on the desktop. Read about it here: http://blogs.msdn.com/b/winsdk/archive/2009/07/14/launching-an-interactive-process-from-windows-service-in-windows-vista-and-later.aspx

If you still want to try it, after reading that, then I wish you all the good luck in the world!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top