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();
}