X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0dabb2a2c6ae27df135da4752b00579346bb74fc..f01fbad837f6be9afed3e346b1b28dced163c9f5:/wxPython/contrib/activex/wxie/wxactivex.cpp diff --git a/wxPython/contrib/activex/wxie/wxactivex.cpp b/wxPython/contrib/activex/wxie/wxactivex.cpp index 7738d6ff57..bef4563dc9 100644 --- a/wxPython/contrib/activex/wxie/wxactivex.cpp +++ b/wxPython/contrib/activex/wxie/wxactivex.cpp @@ -85,6 +85,8 @@ BEGIN_EVENT_TABLE(wxActiveX, wxWindow) EVT_KILL_FOCUS(wxActiveX::OnKillFocus) END_EVENT_TABLE() +IMPLEMENT_CLASS(wxActiveX, wxWindow) + class wxActiveX; class FrameSite : @@ -296,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; //////////////////////////////////////////////////////// @@ -315,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"); @@ -413,7 +421,7 @@ void wxActiveX::CreateActiveX(REFCLSID clsid) // Update by GBR to resize older controls wxSizeEvent szEvent; szEvent.m_size = wxSize(w, h) ; - AddPendingEvent(szEvent); + GetEventHandler()->AddPendingEvent(szEvent); }; } @@ -891,7 +899,7 @@ public: { // cdecl call // sometimes the pDispParams does not match the param info for a activex control - int nArg = min(func.params.size(), pDispParams->cArgs); + int nArg = wxMin(func.params.size(), pDispParams->cArgs); for (int i = nArg - 1; i >= 0; i--) { VARIANTARG& va = pDispParams->rgvarg[i]; @@ -906,8 +914,8 @@ public: if (func.hasOut) { - int nArg = min(func.params.size(), pDispParams->cArgs); - m_activeX->GetParent()->ProcessEvent(event); + int nArg = wxMin(func.params.size(), pDispParams->cArgs); + m_activeX->GetEventHandler()->ProcessEvent(event); for (int i = 0; i < nArg; i++) { VARIANTARG& va = pDispParams->rgvarg[i]; @@ -922,7 +930,7 @@ public: }; } else - m_activeX->GetParent()->AddPendingEvent(event); + m_activeX->GetEventHandler()->AddPendingEvent(event); }; @@ -1767,6 +1775,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)