I have a set of server applications that run in the taskbar. I am trying to write a small server management application in C # that can gracefully close applications. However, itβs hard for me to figure out how to do this.
I can get the process (an instance of the Process class). The call to Process.CloseMainWindow () does not work. You do not get Process.MainWindowHandle for the task tray process (it is zero and is documented that it is), so I cannot send, say, the message WM_SYSCOMMAND, SC_CLOSE.
I can kill (), but it's not elegant. Any ideas? Server applications are written in Delphi Win32. I can change them.
source share