Listening to another window resize events in C#

Posted by Steve on Stack Overflow See other posts from Stack Overflow or by Steve
Published on 2010-05-21T07:06:24Z Indexed on 2010/05/21 7:10 UTC
Read the original article Hit count: 222

Filed under:
|
|

Hi all

I am implementing a small application (observer) that needs to "attach" itself to the bottom of another window (observed). The latter is not a window inside the application.

At this moment I solved by getting the hWnd of the window and querying periodically in a thread the location of the observed window, moving the observer window accordingly.

However this is a very inelegant solution. What I would like to do is to listen to the resize event of the observed window so that the observer will react only when necessary.

I assume I should use a hook, and I found plenty of ways of doing it, but my lack of knowledge of the C WinAPI is blocking me in understanding which hook I need to create and how (pinvoke/parameters/etc).

I'm pretty sure this is quite trivial, and some of you familiar with C/C++ and WinAPI will have the answer ready at hand ;)

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about hook