m_hWnd直接调用是没问题的,但是调用的时机不对,应增加下面方法:
void CxxxCtrl::OnSetClientSite()
{
if (m_pClientSite)
// It doesn't matter who the parent window is or what the size of
// the window is because the control's window will be reparented
// and resized correctly later when it's in-place activated.
VERIFY (CreateControlWindow (::GetDesktopWindow(), CRect(0,0,0,0),
CRect(0,0,0,0)));
COleControl::OnSetClientSite();
}
本文介绍了一种改进m_hWnd调用的方法,通过在适当的时机调用OnSetClientSite函数,确保了控件窗口能被正确地重新父级化和调整大小。此方法对于控件的初始化和布局管理非常重要。
2235

被折叠的 条评论
为什么被折叠?



