我用CSplitterWnd把窗口分成二个, 有一个的基类是CFormView,
在上面加了一些控件,想动态的改变下,在OnSize函数中:
GetClientRect(&rect);
pWnd = CWnd::GetDlgItem(IDB_BITMAP1);
if(!pWnd)
{
CRect Rect;
pWnd->GetClientRect(&Rect); //这里有错
ScreenToClient(&Rect);
Rect.left = Rect.left*cx/m_Rect.Width();
Rect.right = Rect.right*cx/m_Rect.Width();
Rect.top = Rect.top*cy/m_Rect.Height();
Rect.bottom = Rect.bottom*cy/m_Rect.Height();
pWnd->MoveWindow(Rect);
}
调试报错:
_AFXWIN_INLINE void CWnd::GetClientRect(LPRECT lpRect) const
{ ASSERT(::IsWindow(m_hWnd)); ::GetClientRect(m_hWnd, lpRect); }
大概意思是不能识别m_hWnd, 要咋办?
xiao