AliR.
Maybe because GetDlgItem is returning NULL.
A couple of things to point out.
I would use cx, and cy instead of calling GetClientRect.
Whenever posible use CRect instead of RECT. It comes with methods like
Width() and Height().
AliR.
"Peter Olcott" <NoSpam@SeeScreen.com> wrote in message
news:XPfNh.12625$Ng1.3615@newsfe19.lga...
void CScrollBitmapDlg::OnSize(UINT nType, int cx, int cy) {
CEdit *editbox = (CEdit *) GetDlgItem(IDC_EDIT1);
RECT rect;
this->GetClientRect(&rect);
int Width = rect.right - rect.left;
int Height = rect.bottom - rect.top;
//editbox->MoveWindow(&rect);
editbox->SetWindowPos(NULL, 0, 0, Width, Height, SWP_NOMOVE |
SWP_NOZORDER);
CDialog::OnSize(nType, cx, cy);
}
Why isn't this code correctly changing the size of the editbox to match
the size of the DialogBox?