I have a C # application that I want to instruct you to stop working from another process. I also want to ask him to open the main window. I have a link to its main window handle.
I know that I can do this using complex schemes such as remote or WCF. the question is, can I do this using simpler mechanisms like window messages or OnClose event handlers for windows in a C # application
Pinvoke SendMessage () to send the WM_CLOSE message to the main application window. Asking him to open the main window will probably be quite difficult; you cannot get a window handle until a window is created. Process.Start () will be the usual way.
Low cost alternative to WCF and superior to pinvoke - it is a named pipe or socket for interacting with the application. This requires the ability to change the source code of the application.
I think you could use FindWindowto search for the correct child window, and then SendMessageor PostMessageto submit WM_CLOSE.
FindWindow
SendMessage
PostMessage
WM_CLOSE
Here is another StackOverflow question that deals with this in C #.
: , , Process.CloseMainWindow .
Process.CloseMainWindow
http://msdn.microsoft.com/en-us/library/system.diagnostics.process.closemainwindow.aspx
"" , - - . api .... - , , .