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

// TODO: Add your message handler code here

if(nType==SIZE_MAXIMIZED )
{ CRect m_CRect_List=m_oldCRect_List;
CRect m_CRect_Ok=m_oldCRect_Ok; m_CRect_List.right=m_full_cx-m_CRect_Ok.Width()-m_CRect_List.left; m_CRect_Ok.left=m_CRect_List.right+5;
m_CRect_Ok.right=m_CRect_Ok.left+m_oldCRect_Ok.Width(); m_ctrl_List.MoveWindow(m_CRect_List);
m_ctrl_ok.MoveWindow(m_CRect_Ok);

}else if(nType==SIZE_RESTORED)
{
m_ctrl_List.MoveWindow(m_oldCRect_List); //have error
m_ctrl_ok.MoveWindow(m_oldCRect_Ok); //have error
}
}以上程序中m_ctrl_List and m_ctrl_ok 分别为列表与按钮控件,m_oldCRect_List记录最初控件的位置。编译时没有问题,但是运行时却有错误发生(第二个if中说m_ctrl_List不是一个window),为什么第一个IF中就不会有这样的问题呢。