Which message do I have to override to move a modal dialog partly out
of screen?
Hallo, I have a modal dialog of dynamical size.
I populate the dialog with a variable number of
controls in OnInitDialog and modify the overall
size of the dialog appropriately.
So it may happen that the dialog's height becomes
larger than the screen is. In this case the user
cannot see the bottom controls. I thought it to
be a good idea to override WM_NCHITTEST in
such a case:
UINT CDlgParameter::OnNcHitTest(CPoint point)
{
CRect rect;
GetWindowRect(&rect);
UINT nHit = CDialogTts::OnNcHitTest(point);
if (rect.Width() > GetSystemMetrics(SM_CXSCREEN) ||
rect.Height() > GetSystemMetrics(SM_CYSCREEN))
{
if (nHit == HTCLIENT)
nHit = HTCAPTION;
}
return nHit;
}
So now the user can drag the dialog by clicking
into the client area.
However, when moving the dialog up so that it's caption
is out of the screen, when the left mouse button is released,
then the dialog jumps back down so that a part of the
caption becomes visible again.
Which message/function do i have to override to prevent this?
I really cannot remember.