I'm trying to make use of the WM_GETTITLEBARINFOEX message on a Windows 7 machine. It seems however that the sizes for the Minimize, Maximize, and Close buttons are incorrect until the user resizes the window. See the attached bitmap. I'm outlining the rect for each button (in green) and the rect for the titlebar (in red). The first image shows the data I get after the window is launched. The second image shows the data I get after I resize the window just slightly. It seems like the rects for the system buttons are correctly determined only after a resize. Does this make sense to anyone? Is there a way I can force the correct values to be determined without a resize?
When exactly do you "make use of the WM_GETTITLEBARINFOEX message"?
Maybe the visual styles were not applied yet?
Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
Convenience and productivity tools for Microsoft Visual Studio: FeinWindows - replacement windows manager for Visual Studio, and more...
In this particular case, I'm in the OnCreate(LPCREATESTRUCT) handler for my frame class, after calling the base class. It's possible that the visual styles haven't yet been applied, but I'm not sure when they happen. I did a quick 'hack' where I post a message to myself in the OnCreate handler and when I handle that message, send the WM_GETTITLEBARINFOEX message again, and at that point the data seems correct. So maybe I'm just calling it too early in the creation of the frame.
Another thing - when I run in Windows Classic mode on Windows 7, the rectangles WM_GETTITLEBARINFOEX returns are incorrect for the buttons. I can't seem to find a reliable way to get the rectangles for these system buttons regardless of the OS or theme.
* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.