Is there a way to attach an event to a foreign / separate window from an .NET process that when the foreign window is closed or is about to close my application can be notified?
I found this http://msdn.microsoft.com/en-us/library/ms229658.aspx
But that seems to only be for the .NET compact framework. I am looking for something using the .NET 2.0 framework.
There’s an article on CodeProject that looks at using global hooks to receive windows messages from other applications.
Can you wait for the process to exit?
Or are you stuck needing to poll and check that you can still Find the window?