在formview中调用函数时会出错,说是ConstructList 的hwnd=???,应该怎样改呢?void CSwitchFormView::OnSize(UINT nType, int cx, int cy) 
{
CFormView::OnSize(nType, cx, cy);

// TODO: Add your message handler code here
CListCtrl* ConstructList;
ConstructList = (CListCtrl*) GetDlgItem(IDC_LISTCONTROLF); ConstructList->MoveWindow(0,0,cx,cy);
}

解决方案 »

  1.   

    ConstructList = ...;
    if(ConstructList != NULL )
        ConstructList->MoveWindow(...);
      

  2.   

    CListCtrl* ConstructList = NULL;
    ConstructList = (CListCtrl*) GetDlgItem(IDC_LISTCONTROLF);
             if(ConstructList && ConstructList->m_hWnd)
                 ConstructList->MoveWindow(0,0,cx,cy);
      

  3.   

    谢谢二位。我改过之后listctrl始终和fraim保持一致的,而formview大小还不一样,所以可以露出formview的边。能处理掉么?
      

  4.   

    formview.ModifyStyle(WS_BORDER, NULL)