我已按照此链接获取 ActiveX 控件的窗口句柄
来自微软网站的示例代码
// The following code should return the actual parent window of the ActiveX control.
HWND CMyOleControl::GetActualParent()
{
HWND hwndParent = 0;
// Get the window associated with the in-place site object,
// which is connected to this ActiveX control.
if (m_pInPlaceSite != NULL)
m_pInPlaceSite->GetWindow(&hwndParent);
return hwndParent; // Return the in-place site window handle.
}
但就我而言,我不断发现“m_pInPlaceSite”始终为 NULL。我正在尝试在我的控件 FinalConstruct 中运行此代码。我还需要为 m_pInPlaceSite 赋予一个值吗?还是我需要 Query 来获取值。
谢谢