true if the close message was successfully sent; false if the associated process does not have a main window or if the main window is disabled (for example if a modal dialog is being shown).
When a process is executing, its message loop is in a wait state. The message loop executes every time a Windows message is sent to the process by the operating system. Calling Process.CloseMainWindow sends a request to close to the main window, which, in a well-formed application, closes child windows and revokes all running message loops for the application. The request to exit the process by calling Process.CloseMainWindow does not force the application to quit. The application can ask for user verification before quitting, or it can refuse to quit. To force the application to quit, use the Process.Kill method. The behavior of Process.CloseMainWindow is identical to that of a user closing an application's main window using the system menu. Therefore, the request to exit the process by closing the main window does not force the application to quit immediately.
Data edited by the process or resources allocated to the process can be lost if you call Process.Kill. Process.Kill causes an abnormal process termination, and should be used only when necessary. Process.CloseMainWindow enables an orderly termination of the process and closes all windows, so it is preferable for applications with an interface. If Process.CloseMainWindow fails, you can use Process.Kill to terminate the process. Process.Kill is the only way to terminate processes that do not have graphical interfaces.
You can call Process.Kill and Process.CloseMainWindow only for processes that are running on the local computer. You cannot cause processes on remote computers to exit. You can only view information for processes running on remote computers.