AdjustWindowRect on a dialog works, but it forgets the caption bar ?

Giganews Newsgroups
Subject: AdjustWindowRect on a dialog works, but it forgets the caption bar ?
Posted by:  R.Wieser (addre…@not.available)
Date: Wed, 6 Feb 2019

Hello all,

I've got a problem with AdjustWindowRect: It looks to be ignoring the height
of the caption bar. :-(

What I did:
I created a dialog with a button in its bottom-right corner.  On pushing it
I use GetWindowRect to get the position and size of the dialog (I subtract
the left and top from right and bottom), which I than apply AdjustWindowRect
to (providing it with the GetWindowLong, GWL_STYLE result).  After that I
use MoveWindow to resize and redraw the dialog.

The result :  The dialog moves up to account for the caption bar. The
problem is that the bottom moves up too (about the height of the caption
bar), while it *should* be going down a little (to account for bottom
border).

Has anyone seen this happen and if so knows what is going on - and perhaps
how to fix it ?

By-the-by: the below is the currently available MSDN(?) page for the above
function.  Which doesn't mention anything in regard to it. :-\

https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-adjustwindowrect

Regards,
Rudy Wieser

Replies