I want to terminate a number of processes, but I want to give each process the chance to save its data, ask the user about saving a file and even ignore the close request.>
You can use taskkill /im your_program.exe to send a termination signal to the application. It will trigger a WM_CLOSE to windows message queue. You can use Either https://msdn.microsoft.com/en-us/library/windows/desktop/ms633573(v=vs.85).aspx or
https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getmessage
to process the message.
Please refer a similar answer Win32 API analog of sending/catching SIGTERM