MSDN Archive Home
Help and FAQs
WPF Shell Integration Library
All Resource Updates
Create New Discussion
Aero caption buttons get stuck glowing. Inconsistent resize cursor. Problems with auto-hide taskbar.
Feb 21 2012 at 3:06 PM
Feb 23 2012 at 3:47 AM
Thanks for your work on this library. It has been very useful for developing an application with a custom glass window chrome. Unfortunately, I have been having some issues with it. The first issue that I ran into was that of the glass turning black when the window was maximised. I was able to fix this by downloading the modified library from the Fishbowl application, and then sacrificing the bottom and right edges via the SacrificialEdge property. I have now noticed three other issues that I have been unable to fix...
The first and most important issue, is that the Aero caption buttons (minimise, maximise, and close) can all get stuck with their blue or red glow permanently active, as though the mouse is always hovering over them. This can be easily reproduced by flicking the mouse across them in an upward direction, with the mouse exiting the window after passing over the caption buttons. They then keep their mouse over glow permanently until the mouse re-enters any point on the window. I have put together an image to help explain the bug in case my description isn't clear:
I have noticed that if I include the top edge in the SacrificialEdge property, this bug no longer occurs. This is not an option for me, though, as I need to be able to draw content at the very top of the window.
Opera 11, Google Chrome 17, and Internet Explorer 9 all suffer from this exact same issue, and they also extend the Aero glass at the top of the window, just like my own application. However, Firefox 10, which also extends the Aero glass at the top of the window in the same way, does not suffer from this issue. Perhaps the developers of Firefox have included some sort of workaround for this? (
Windows Explorer somehow manages to avoid this issue, also.)
When resizing the window, the cursor is inconsistent. The cursor always correctly changes to a double-arrow cursor when hovering the mouse over any resize edge. When actually clicking and dragging with the left-mouse button to resize, however, the issue occurs. Sometimes it correctly stays set to the double-arrow cursor, and other times it incorrectly changes back to the ordinary select cursor.
When the taskbar is set to auto-hide, and the window is maximised, it becomes impossible to bring up the taskbar by moving the mouse to the bottom of the screen. Normally moving the mouse to the bottom of the screen causes the taskbar to pop up, but this no longer happens.
Do you have any ideas on how to fix any of these issues? It would be much appreciated.
Thanks in advance.
Mar 8 2012 at 3:58 AM
Unfortunately working around any of these issues will involve tweaking the Win32 interop aspects of the library. I am no longer with Microsoft, so I can't really update the code but hopefully I can guide you in the right directions. If you're unfamiliar with how the library actually works you might want to check out the blog post I wrote that details the techniques: http://blogs.msdn.com/b/wpfsdk/archive/2008/09/08/custom-window-chrome-in-wpf.aspx
1. I've seen that happen but it was never consistent. The only way I could think of to handle it was to poke the WndProc to invoke DwmDefWindowProc on a timer in the case that the last handled message indicated it was over those buttons (I think WM_CAPTION is about as precise as you can get). I hadn't realized that using the SacrificialEdge.Top property would fix it though. In that case what you may be able to do is make the code that handles SacrificialEdge make it only sacrifice 1 pixel instead of 8. I implemented it with 8 pixels to make it easier to get Office type behavior, but technically because of what was causing the black glass bug it should work if you have only 1 pixel, which may work okay for what you're doing. There are a couple places in the code that account for that 8 pixels, so be careful updating it.
2. I'm not sure about that one. The cursor changes based on the WndProc's response to WM_NCHITTEST. It may occasionally be hitting a reentrancy issue, but I don't know without debugging it. If it's happening a lot you can probably catch in the WndProc when you're triggering a resize and explicitly set the cursor to whatever is appropriate. Doing that may be tricky.
3. This bug is annoying. It happens with a lot of applications. The only way I know to solve it is when the window maximizes you can explicitly call SetWindowPos to resize and reposition it to leave one row of pixels visible on the desktop. If you pay attention you'll see this makes the window look different than others that don't need this fix. It's unfortunate :( If you decide to fix it, things to keep in mind:
multi-mon - you only want to do this if the window is maximizing on the primary monitor.
taskbars docked against alternate edges - you actually want to make sure that the one pixel row/column is where the auto-hidden task bar is located.
it's really pretty rare for people to have the task bar autohidden. The cost and complexity of doing this didn't seem to be worth it for how much impact the bug really has (pressing ctrl-esc or the windows key does still work).
I hope that helps,
Sign in to post message or set email notifications
Manage Your Profile
MSDN Flash Newsletter
© 2008 Microsoft Corporation. All rights reserved.