How to get window opened/closed/minimized messages from a native app?

Posted by Josh Santangelo on Stack Overflow See other posts from Stack Overflow or by Josh Santangelo
Published on 2010-03-31T19:05:45Z Indexed on 2010/03/31 20:33 UTC
Read the original article Hit count: 339

Filed under:
|
|
|

It's tough to write a good title for this one.

I'm working on a WPF application which needs to know about the existence of all other open windows on the system. I'm able to do this by calling the native EnumWindows method just fine, and I can call other native methods to filter out just the windows I'm interested in. This works well.

The problem I'm having is that I want to know when a window is opened or closed (and, ideally, minimized). I can do this by polling with EnumWindows, but I'm finding that to be pretty slow, even if I push it off to another thread.

Is there a better way to get notifications of window opened/closed/minimized? Keep in mind that my knowledge of non-managed code is pretty limited.

© Stack Overflow or respective owner

Related posts about win32

Related posts about .NET