让控件随对话框大小改变而变化,大家看看代码哪错了。没报错。该怎么处理

让控件随对话框大小改变而变化,大家看看代码哪错了。没报错。
class   CFfDlg   :   public   CDialog
{
//   Construction
public:
CFfDlg(CWnd*   pParent   =   NULL);
BOOL   forl;
int   biliw;
                  int   bilih;//   standard   constructor
                  CRect   rect1,rect2;
。。。。
};

BOOL   CFfDlg::OnInitDialog()
{
CDialog::OnInitDialog();
              ...........................
GetClientRect(&rect2);
GetDlgItem(IDC_EDIT1)-> GetWindowRect(&rect1);
biliw=rect2.right-rect1.right;
bilih=rect2.bottom-rect1.bottom;
forl=TRUE;

return   TRUE;    
}


void   CFfDlg::OnSize(UINT   nType,   int   cx,   int   cy)  
{
CDialog::OnSize(nType,   cx,   cy);

if(forl==TRUE){
CWnd       *       pWnd       =       GetDlgItem(IDC_EDIT1);      
    if(       pWnd       )      
    {      
        CRect       rctmp;      
        GetWindowRect(&rctmp);
CRect   rectm(rect1.left,rect1.top,rctmp.right-biliw,rctmp.bottom-bilih);
    pWnd-> MoveWindow(&rectm);      
    }      

}
}

------解决方案--------------------
最好不要用标志,在onpaint之前会先onsize,用标志的话还要在构造中设置初始值,用GetSafeHwnd来做,ON_WM_SIZE()有没有