X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a96fdef31fa83fbe6e8dac52dfe141c75ee789a2..8ec09aacc6d8a0ef8c8e3910c46258bc20f0734b:/wxPython/contrib/activex/wxie/wxactivex.cpp diff --git a/wxPython/contrib/activex/wxie/wxactivex.cpp b/wxPython/contrib/activex/wxie/wxactivex.cpp index 96a4a51480..77d372d993 100644 --- a/wxPython/contrib/activex/wxie/wxactivex.cpp +++ b/wxPython/contrib/activex/wxie/wxactivex.cpp @@ -298,12 +298,13 @@ wxActiveX::~wxActiveX() m_oleObject->Close(OLECLOSE_NOSAVE); m_oleObject->SetClientSite(NULL); } + + // Unregister object as active + RevokeActiveObject(m_pdwRegister, NULL); } void wxActiveX::CreateActiveX(REFCLSID clsid) { - SetTransparent(); - HRESULT hret; //////////////////////////////////////////////////////// @@ -317,10 +318,15 @@ void wxActiveX::CreateActiveX(REFCLSID clsid) wxCHECK_RET(adviseSink.Ok(), _T("adviseSink not Ok")); - // // Create Object, get IUnknown interface + // Create Object, get IUnknown interface m_ActiveX.CreateInstance(clsid, IID_IUnknown); wxCHECK_RET(m_ActiveX.Ok(), _T("m_ActiveX.CreateInstance failed")); + // Register object as active + unsigned long pdwRegister; + hret = RegisterActiveObject(m_ActiveX, clsid, ACTIVEOBJECT_WEAK, &m_pdwRegister); + WXOLE_WARN(hret, "Unable to register object as active"); + // Get Dispatch interface hret = m_Dispatch.QueryInterface(IID_IDispatch, m_ActiveX); WXOLE_WARN(hret, "Unable to get dispatch interface"); @@ -1164,9 +1170,35 @@ void wxActiveX::GetTypeInfo(ITypeInfo *ti, bool defInterface, bool defEventSink) ConnectAdvise(ta->guid, disp); }; + // Get properties + // See bug #1280715 in the wxActiveX SF project + int i; + for (i = 0; i < ta->cVars; i++) { + VARDESC FAR *vd = NULL; + + typeInfo->GetVarDesc(i, &vd) ; + BSTR bstrProperty = NULL; + typeInfo->GetDocumentation(vd->memid, &bstrProperty, + NULL, NULL, NULL); + wxString propName(bstrProperty); + m_props.push_back(PropX()); + int idx = m_props.size() - 1; + m_propNames[propName] = idx; + m_props[idx].name = propName; + m_props[idx].memid = vd->memid; + + ParamX param; + param.isSafeArray = false; + param.isPtr = false; + param.flags = vd->elemdescVar.idldesc.wIDLFlags; + param.vt = vd->elemdescVar.tdesc.vt; + + m_props[idx].arg = param; + m_props[idx].type = param; + } // Get Function Names - for (int i = 0; i < ta->cFuncs; i++) + for (i = 0; i < ta->cFuncs; i++) { FUNCDESC FAR *fd = NULL; @@ -1674,7 +1706,6 @@ void wxActiveX::OnPaint(wxPaintEvent& event) { wxLogTrace(wxT(""),wxT("repainting activex win")); wxPaintDC dc(this); - dc.BeginDrawing(); int w, h; GetSize(&w, &h); RECT posRect; @@ -1699,7 +1730,6 @@ void wxActiveX::OnPaint(wxPaintEvent& event) dc.DrawRectangle(0, 0, w, h); dc.SetBrush(wxNullBrush); } - dc.EndDrawing(); } @@ -1769,6 +1799,16 @@ void wxActiveX::OnMouse(wxMouseEvent& event) wxLogTrace(wxT(""),wxT("msg sent")); } +bool wxActiveX::MSWTranslateMessage(WXMSG *msg){ + + if (msg->message == WM_KEYDOWN){ + HRESULT result = m_oleInPlaceActiveObject->TranslateAccelerator(msg); + return (result == S_OK); + } + + return wxWindow::MSWTranslateMessage(msg); +} + long wxActiveX::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { if (m_oleObjectHWND == NULL)