how to close a window from a different process
问题 I have a c# application which I want to instruct to shutdown nicely, from a different process. I also want to be able to ask it to open its main window. I have a reference to its main window handle. I know I can do it using elaborate schemes such as remoting or WCF. the question is can I do it using simpler mechanisms such as window messages, or the OnClose event handlers of the window in the c# application 回答1: Pinvoke SendMessage() to send the WM_CLOSE message to the app's main window.