I have an application that I use to request applications to shutdown. I iterate through the running processes, get the name of the executable and compare it against the list of executables that need to be shutdown. If I find it on the list, I want to post a message to its main message loop.
The old (ok ancient) windows API call was [tt]PostAppMessage[/tt] that took a task handle. MSDN lists this function as an 'Obsolete Windows Programming Element' and lists [tt]PostThreadMessage[/tt] as the replacement. [tt]PostThreadMessage[/tt] requires a threadid.
I was previously enumerating the system windows, looking for one that matched and posting the message to the window, but the applications no-longer have a 'main' window that I can uniquely identify.
I'm also open to other ideas if you have any.
The old (ok ancient) windows API call was [tt]PostAppMessage[/tt] that took a task handle. MSDN lists this function as an 'Obsolete Windows Programming Element' and lists [tt]PostThreadMessage[/tt] as the replacement. [tt]PostThreadMessage[/tt] requires a threadid.
I was previously enumerating the system windows, looking for one that matched and posting the message to the window, but the applications no-longer have a 'main' window that I can uniquely identify.
I'm also open to other ideas if you have any.