I'm dropping a child window onto a toolwindow, and I need to size the toolwindow to match the child. My attempt was such: ; get size of child invoke GetWindowRect, hWndChild, ADDR rc ; get parent style invoke GetWindowLong, hParent, GWL_STYLE ; adjust child rect for parent size invoke AdjustWindowRect, ADDR rc, eax, FALSE ; calculate width and height mov eax, rc.left sub rc.right, eax mov eax, rc.top sub rc.bottom, eax ;re-size the parent invoke SetWindowPos, hToolTab, NULL, 0, 0, rc.right, rc.bottom, SWP_NOMOVE or SWP_NOZORDER My results are: the width looks perfect, but the client height is off by 3 pixles too much. Sure, I can just subtrace 3, but any ideas as to why I need to do this?
Posted on 2001-01-23 13:05:00 by Ernie
The problem is WS_EX_TOOLWINDOW is an extended style and AdjustWindowRect adjusts the rect based on normal styles so use AdjustWindowRectEx.
Posted on 2001-01-23 20:17:00 by Varunun