views:

25

answers:

1

I've got an application window in which I'm adding the WS_THICKFRAME style and I have removed the WS_CAPTION style. When the window maximizes, I want to hide the WS_THICKFRAME, but retain the Aero-Snap feature, so I have altered my handler for WS_NCCALCSIZE to return an inflated rect with respect to the size of the window borders.

That is, the important part of the WS_NCCLIENTSIZE handler code looks like this:

...
CRect rc( lpncsp->rgrc[0] );
if (IsZoomed())
{
    int borderSize = GetSystemMetrics(SM_CYSIZEFRAME);
    rc.InflateRect(borderSize,topOff+borderSize,borderSize,borderSize);
}
else
    rc.InflateRect(0,topOff+0,0,0);

lpncsp->rgrc[0] = rc;
...

That code effectively makes the WS_THICKFRAME hidden.

Only problem is that when the window loses focus or regains focus (while maximized) the WS_THICKFRAME gets drawn within the boundary. Is there a message in which I can return the Inflated rect back or at least re-adjust the window size to hide the WS_THICKFRAME again when the window focus is set/unset?

+1  A: 

Yeah, that won't work. Implement a message handler for WM_GETMINMAXINFO to allow the borders of the window to fall off the screen. Beware that if you didn't set the linker's /SUBSYSTEM option to say that your program is made for Vista or Win7 (version 6,0) then Aero will lie to you when you use GetWindowRect(). The value you get back is based on thin (legacy) borders.

Hans Passant
IF you set the /SUBSYSTEM option for Vista/W7, will the program work on XP?
Mike Caron
Nope, it will not.
Hans Passant
Ok, then that's not an option. Thanks for the info, though.
Mike Caron