我在视图类中创建一对话框,我想这个对话框随着主框架的大小而不段改变,使的对话框的大小不能越出住框架.且对话框位于视图区的左上方.我写了如下代码,但出现了问题,还请高手指点.错在什么地方.
CRect rect;
GetWindowRect(&rect);
         ScreenToClient(&rect);
int width=rect.right-rect.left;
int height=rect.bottom-rect.top;    CMDIFrameWnd *pFrame = (CMDIFrameWnd*)AfxGetApp()->m_pMainWnd;     // Get the active MDI child window.
    CMDIChildWnd *pChild = (CMDIChildWnd *) pFrame->GetActiveFrame();    CView *pView = (CView *) pChild->GetActiveView();


    pView->GetClientRect(rect);
ClientToScreen(&rect);
    MoveWindow(rect.left,rect.top,rect.left+width,rect.top+height);