Activate OLE ActiveX controls before requesting their window.

Change the order of IOkeInPlaceActiveObject::GetWindow() and
DoVerb(OLEIVERB_INPLACEACTIVATE) calls and do the latter first now as
otherwise GetWindow() returned NULL for standard ActiveX controls created by
MFC.

Closes #14209.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72027 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-07-11 11:42:34 +00:00
parent 17de606b77
commit d1877f8400

View File

@@ -1110,16 +1110,20 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk)
m_oleObjectHWND = 0;
if (m_oleInPlaceObject.IsOk())
{
hret = m_oleInPlaceObject->GetWindow(&m_oleObjectHWND);
if (SUCCEEDED(hret))
::SetActiveWindow(m_oleObjectHWND);
}
if (! (dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME))
{
hret = m_oleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL,
m_clientSite, 0, (HWND)m_realparent->GetHWND(), NULL);
CHECK_HR(hret);
if (m_oleInPlaceObject.IsOk())
{
hret = m_oleInPlaceObject->GetWindow(&m_oleObjectHWND);
CHECK_HR(hret);
::SetActiveWindow(m_oleObjectHWND);
}
RECT posRect;
wxCopyRectToRECT(m_realparent->GetClientSize(), posRect);
@@ -1129,10 +1133,6 @@ void wxActiveXContainer::CreateActiveX(REFIID iid, IUnknown* pUnk)
m_oleInPlaceObject->SetObjectRects(&posRect, &posRect);
}
hret = m_oleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL,
m_clientSite, 0, (HWND)m_realparent->GetHWND(), &posRect);
CHECK_HR(hret);
hret = m_oleObject->DoVerb(OLEIVERB_SHOW, 0, m_clientSite, 0,
(HWND)m_realparent->GetHWND(), &posRect);
CHECK_HR(hret);