响应对话框的WM_SIZE消息,来动态改变对话框上控件的位置何大小。代码如下:
void CMy111Dlg::OnSize(UINT nType, int cx, int cy) 
{
        CDialog::OnSize(nType, cx, cy);
        
        // TODO: Add your message handler code here
        switch (nType)
        {
        case SIZE_MAXIMIZED:
                m_tree.MoveWindow(0,0,cx*3.0/8,cy);
                m_list.MoveWindow(cx*3.0/8,0,cx*5.0/8,cy*5.0/8);
                m_edit.MoveWindow(cx*3.0/8,cy*5.0/8,cx*5.0/8,cy*3.0/8);
                break;
  /*      case SIZE_RESTORED:
   *             m_tree.MoveWindow(0,0,cx*3.0/8,cy);
   *             break;
   */
        default:
                break;
        }
}
其中/***/注释掉程序可以正常运行,就是只能响应窗口最大化的消息,可是怎么响应
窗口的大小任意改变呢??如果把/***/部分注释掉,run出错为:void CWnd::MoveWindow(int x, int y, int nWidth, int nHeight, BOOL bRepaint)
{
        ASSERT(::IsWindow(m_hWnd));//////ASSERT出错??????????        if (m_pCtrlSite == NULL)
                ::MoveWindow(m_hWnd, x, y, nWidth, nHeight, bRepaint);
        else
                m_pCtrlSite->MoveWindow(x, y, nWidth, nHeight, bRepaint);
}
请高手指教,聆听ing!