C # and Win32 notify of closing / closing a separate window

Is there a way to bind an event to an external / separate window from the .NET process, which, when the external window closes or is about to close my application, can be notified?

I found this http://msdn.microsoft.com/en-us/library/ms229658.aspx

But this is only like the .NET compact framework. I am looking for something using the .NET 2.0 framework.

Thanks.

+1
source share
2 answers

There's an article on CodeProject that explores the use of global interceptors to receive Windows messages from other applications.

Can you wait for the process to exit ?

Or are you stuck with the need for a survey and make sure you can still find the window?

+4
source

Take a look at SetWindowsHookEx with the WH_CBT parameter. There will be an HCBT_DESTROYWND entry.

0
source

Source: https://habr.com/ru/post/1285654/


All Articles