1 Attachment(s)
WM_GETTITLEBARINFOEX has wrong button rects
Hi everyone -
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?
Re: WM_GETTITLEBARINFOEX has wrong button rects
When exactly do you "make use of the WM_GETTITLEBARINFOEX message"?
Maybe the visual styles were not applied yet?
Re: WM_GETTITLEBARINFOEX has wrong button rects
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.
1 Attachment(s)
Re: WM_GETTITLEBARINFOEX has wrong button rects
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.