X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/83a732882adf32f93d25cd7e3a0ad20f7231ec49..f6f98ecccd755993c8ba6354281fad271917be25:/wxPython/contrib/iewin/wxactivex.cpp?ds=sidebyside diff --git a/wxPython/contrib/iewin/wxactivex.cpp b/wxPython/contrib/iewin/wxactivex.cpp index 575d2fae2b..ac6df87513 100644 --- a/wxPython/contrib/iewin/wxactivex.cpp +++ b/wxPython/contrib/iewin/wxactivex.cpp @@ -207,7 +207,7 @@ wxActiveX::wxActiveX(wxWindow * parent, wxString progId, wxWindowID id, { m_bAmbientUserMode = true; m_docAdviseCookie = 0; - CreateActiveX((LPOLESTR) wxConvUTF8.cMB2WC(progId).data()); + CreateActiveX((LPOLESTR) (const wchar_t *) progId.wc_str(wxConvUTF8)); } wxActiveX::~wxActiveX() @@ -268,7 +268,17 @@ void wxActiveX::CreateActiveX(REFCLSID clsid) // Get IOleObject interface hret = m_oleObject.QueryInterface(IID_IOleObject, m_ActiveX); wxASSERT(SUCCEEDED(hret)); - // Get IOleInPlaceObject interface + + // document advise + m_docAdviseCookie = 0; + hret = m_oleObject->Advise(adviseSink, &m_docAdviseCookie); + WXOLE_WARN(hret, "m_oleObject->Advise(adviseSink, &m_docAdviseCookie),\"Advise\")"); + m_oleObject->SetHostNames(L"wxActiveXContainer", NULL); + OleSetContainedObject(m_oleObject, TRUE); + OleRun(m_oleObject); + + + // Get IOleInPlaceObject interface hret = m_oleInPlaceObject.QueryInterface(IID_IOleInPlaceObject, m_ActiveX); wxASSERT(SUCCEEDED(hret)); @@ -292,13 +302,6 @@ void wxActiveX::CreateActiveX(REFCLSID clsid) WXOLE_WARN(hret, "CreateActiveX::pPersistStreamInit->InitNew()"); }; - // document advise - m_docAdviseCookie = 0; - hret = m_oleObject->Advise(adviseSink, &m_docAdviseCookie); - WXOLE_WARN(hret, "m_oleObject->Advise(adviseSink, &m_docAdviseCookie),\"Advise\")"); - m_oleObject->SetHostNames(L"wxActiveXContainer", NULL); - OleSetContainedObject(m_oleObject, TRUE); - if (! (dwMiscStatus & OLEMISC_SETCLIENTSITEFIRST)) m_oleObject->SetClientSite(m_clientSite); @@ -312,22 +315,26 @@ void wxActiveX::CreateActiveX(REFCLSID clsid) posRect.bottom = h; m_oleObjectHWND = 0; - hret = m_oleInPlaceObject->GetWindow(&m_oleObjectHWND); - WXOLE_WARN(hret, "m_oleInPlaceObject->GetWindow(&m_oleObjectHWND)"); - if (SUCCEEDED(hret)) - ::SetActiveWindow(m_oleObjectHWND); + + if (m_oleInPlaceObject.Ok()) + { + hret = m_oleInPlaceObject->GetWindow(&m_oleObjectHWND); + WXOLE_WARN(hret, "m_oleInPlaceObject->GetWindow(&m_oleObjectHWND)"); + if (SUCCEEDED(hret)) + ::SetActiveWindow(m_oleObjectHWND); + }; if (! (dwMiscStatus & OLEMISC_INVISIBLEATRUNTIME)) { - if (w > 0 && h > 0) + if (w > 0 && h > 0 && m_oleInPlaceObject.Ok()) m_oleInPlaceObject->SetObjectRects(&posRect, &posRect); hret = m_oleObject->DoVerb(OLEIVERB_INPLACEACTIVATE, NULL, m_clientSite, 0, (HWND)GetHWND(), &posRect); hret = m_oleObject->DoVerb(OLEIVERB_SHOW, 0, m_clientSite, 0, (HWND)GetHWND(), &posRect); }; - if (! m_oleObjectHWND) + if (! m_oleObjectHWND && m_oleInPlaceObject.Ok()) { hret = m_oleInPlaceObject->GetWindow(&m_oleObjectHWND); WXOLE_WARN(hret, "m_oleInPlaceObject->GetWindow(&m_oleObjectHWND)"); @@ -385,13 +392,14 @@ public: static ActiveXEventMapFlusher s_dummyActiveXEventMapFlusher; -const wxEventType& RegisterActiveXEvent(wxString eventName) +const wxEventType& RegisterActiveXEvent(wxChar *eventName) { - ActiveXEventMap::iterator it = sg_eventMap.find(eventName); + wxString ev = eventName; + ActiveXEventMap::iterator it = sg_eventMap.find(ev); if (it == sg_eventMap.end()) { wxEventType *et = new wxEventType(wxNewEventType()); - sg_eventMap[eventName] = et; + sg_eventMap[ev] = et; return *et; }; @@ -857,17 +865,21 @@ void wxActiveX::OnSize(wxSizeEvent& event) if (w <= 0 && h <= 0) return; - if (m_oleInPlaceObject) + if (m_oleInPlaceObject.Ok()) m_oleInPlaceObject->SetObjectRects(&posRect, &posRect); // extents are in HIMETRIC units - SIZEL sz = {w, h}; - PixelsToHimetric(sz); + if (m_oleObject.Ok()) + { + SIZEL sz = {w, h}; + PixelsToHimetric(sz); - SIZEL sz2; - m_oleObject->GetExtent(DVASPECT_CONTENT, &sz2); - if (sz2.cx != sz.cx || sz.cy != sz2.cy) - m_oleObject->SetExtent(DVASPECT_CONTENT, &sz); + SIZEL sz2; + + m_oleObject->GetExtent(DVASPECT_CONTENT, &sz2); + if (sz2.cx != sz.cx || sz.cy != sz2.cy) + m_oleObject->SetExtent(DVASPECT_CONTENT, &sz); + }; } void wxActiveX::OnSetFocus(wxFocusEvent& event)