]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/ole/activex.cpp
Ensure there is valid context for DrawRectangle
[wxWidgets.git] / src / msw / ole / activex.cpp
index ce96506b59dd062c8b0cb9a8e4285f97acd2fccb..8baad0bf012bcab308717ca737bbd20810d29271 100644 (file)
@@ -1110,29 +1110,29 @@ 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))
     {
         RECT posRect;
         wxCopyRectToRECT(m_realparent->GetClientSize(), posRect);
 
+        hret = m_oleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL,
+            m_clientSite, 0, (HWND)m_realparent->GetHWND(), &posRect);
+        CHECK_HR(hret);
+
+        if (m_oleInPlaceObject.IsOk())
+        {
+            hret = m_oleInPlaceObject->GetWindow(&m_oleObjectHWND);
+            CHECK_HR(hret);
+            ::SetActiveWindow(m_oleObjectHWND);
+        }
+
         if (posRect.right > 0 && posRect.bottom > 0 &&
             m_oleInPlaceObject.IsOk())
         {
             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);
@@ -1269,7 +1269,7 @@ void wxActiveXContainer::OnKillFocus(wxFocusEvent& event)
 // wxActiveXContainer::MSWTranslateMessage
 //
 // Called for every message that needs to be translated.
-// Some controls might need more keyboard keys to process (CTRL-C, CTRL-A ect),
+// Some controls might need more keyboard keys to process (CTRL-C, CTRL-A etc),
 // In that case TranslateAccelerator should always be called first.
 //---------------------------------------------------------------------------
 bool wxActiveXContainer::MSWTranslateMessage(WXMSG* pMsg)