]> git.saurik.com Git - wxWidgets.git/commitdiff
Activate OLE ActiveX controls before requesting their window.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 11 Jul 2012 11:42:34 +0000 (11:42 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 11 Jul 2012 11:42:34 +0000 (11:42 +0000)
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

src/msw/ole/activex.cpp

index ce96506b59dd062c8b0cb9a8e4285f97acd2fccb..b034ab1c11470728999e0d70861b9a62f5d9d8e0 100644 (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);