I have a set of server apps that run in the task tray. I'm trying to write a little server management app in c# that can gracefully close the applications. However I'm having trouble figuring out how to do it.
I can get the process (an instance of the Process class). Calling Process.CloseMainWindow() doesn't work. You don't get a Process.MainWindowHandle for a task tray process (it's zero, and is documented that this is the case), so I can't send, say, a WM_SYSCOMMAND, SC_CLOSE message.
I can Kill() it, but that's not graceful. Any ideas? The server apps are written in Delphi Win32. I can modify them.