Reputation: 7311
I would like to end a certain Windows application gracefully, without using a mouse or keyboard shortcuts. I also don't want to simply end the application's process. (Hence, "gracefully".)
In other words, I would like to invoke the application's own "exit procedure". How do I do this?
I don't mind getting down and dirty with code and dubious hacks, I just have no idea where to start… Using AutoHotkey to simulate the key presses required to end the application is not good enough for me. :P
Upvotes: 1
Views: 200
Reputation: 139256
Windows Task Manager uses the EndTask function for this: EndTask Function. This function first sends nice WM_CLOSE messages.
Upvotes: 2
Reputation: 613491
Find the taskbar windows owned by the process (there's usually only one) and send them WM_CLOSE messages.
Upvotes: 0