There are three ways actually, but the section with examples contains only two.
1. Force the process to be aborted. Not quite a safe method for those applications that can have open documents that are not saved.
2. Sending the Alt+F4 key combination to the necessary application. This method is safer than the first one, but it does not work with applications that have no active windows. For example, you won't close xstarter.exe this way .
[3]. Closing the application by sending the close command to the main window of the application.