views:

47

answers:

3

I have some windows docked to edges/corners of the working area, and I need to know if/when the WorkingArea of the screen changes so I can update the position of those windows. I've attempted to tackle this before to no avail, as I recall.

A: 

One way would be to register your windows as an Application Desktop Toolbar (AppBar) http://msdn.microsoft.com/en-us/library/bb776821(VS.85).aspx Then the system will send you notifications when your window needs to be repositioned, resized etc. For example an AppBar receives a ABN_POSCHANGED notification from the system when something occurs that will affect the size/position/visiblity etc. of the AppBar.

You will need to interop to do this, here is a Code Project article on doing this with C#, though I have only done with C++ so I cannot vouch for the article, but it should be a fair starting point. http://www.codeproject.com/KB/dotnet/AppBar.aspx

Chris Taylor
Thanks for the reply. I'll mark this as the answer as it's a good idea, even though I ended up taking a different (simpler, though not as elegant) approach (see post).
chaiguy
A: 

I ended up just taking the very simple approach of running a DispatcherTimer that ticks every two seconds and simply checks the current WorkingArea against the last-checked WorkingArea, sending an event if they are different.

chaiguy
A: 

Is there no windows message being passed to your windows WndProc when the screen changes?

AndrewVos
As far as I recall there's not.. at least not anything reliable.
chaiguy