Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to know when another hwnd has closed?

Tags:

winapi

hwnd

Is there a method for setting up a listener/watcher to know when an unrelated application window is closed?

I can check to see if the window is still open, but that seems silly to continually do.

like image 470
Meep Avatar asked Jan 11 '23 01:01

Meep


1 Answers

The Accessibility API's SetWinEventHook filtering for EVENT_OBJECT_DESTROY.

This is notification based so no polling and unlike a CBT hook does not require injection.

like image 111
Alex K. Avatar answered Feb 24 '23 10:02

Alex K.