I have (in the past) written cross-platform (Windows/Unix) applications which, when started from the command line, handled a user-typed Ctrl–C combination in the same way (i.e. to terminate the application cleanly).
Is it possible on Windows to send a Ctrl–C/SIGINT/equivalent to a process from another (unrelated) process to request that it terminate cleanly (giving it an opportunity to tidy up resources etc.)?
The closest that I’ve come to a solution is the SendSignal 3rd party app. The author lists source code and an executable. I’ve verified that it works under 64-bit windows (running as a 32-bit program, killing another 32-bit program), but I’ve not figured out how to embed the code into a windows program (either 32-bit or 64-bit).
How it works:
(Precede it with
startif running it in a batch file.)