X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f6a39dfaa6d607cf674282818d73616a449606b1..69d31e313035d5e22d9400ec946f6007f710910c:/src/msw/ole/automtn.cpp diff --git a/src/msw/ole/automtn.cpp b/src/msw/ole/automtn.cpp index b99c9c8d92..31348b791a 100644 --- a/src/msw/ole/automtn.cpp +++ b/src/msw/ole/automtn.cpp @@ -159,7 +159,7 @@ bool wxAutomationObject::Invoke(const wxString& member, int action, { namedArgCount = 1; dispIds[1] = DISPID_PROPERTYPUT; - vReturnPtr = (VARIANTARG*) NULL; + vReturnPtr = NULL; } // Convert the wxVariants to VARIANTARGs @@ -220,7 +220,7 @@ bool wxAutomationObject::Invoke(const wxString& member, int action, // Mustn't release the dispatch pointer if (vReturn.vt == VT_DISPATCH) { - vReturn.pdispVal = (IDispatch*) NULL; + vReturn.pdispVal = NULL; } ReleaseVariant(& vReturn); } @@ -440,7 +440,7 @@ WXIDISPATCH* wxAutomationObject::GetDispatchProperty(const wxString& property, i } } - return (WXIDISPATCH*) NULL; + return NULL; } // Uses DISPATCH_PROPERTYGET @@ -458,7 +458,7 @@ WXIDISPATCH* wxAutomationObject::GetDispatchProperty(const wxString& property, i } } - return (WXIDISPATCH*) NULL; + return NULL; } @@ -538,8 +538,13 @@ bool wxAutomationObject::CreateInstance(const wxString& classId) const return false; } - // start a new copy of Excel, grab the IDispatch interface - if (FAILED(CoCreateInstance(clsId, NULL, CLSCTX_ALL, IID_IDispatch, (void**)&m_dispatchPtr))) + // get the server IDispatch interface + // + // NB: using CLSCTX_INPROC_HANDLER results in failure when getting + // Automation interface for Microsoft Office applications so don't use + // CLSCTX_ALL which includes it + if (FAILED(CoCreateInstance(clsId, NULL, CLSCTX_SERVER, IID_IDispatch, + (void**)&m_dispatchPtr))) { wxLogWarning(wxT("Cannot start an instance of this class.")); return false; @@ -726,7 +731,7 @@ wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& variant) break; default: - wxLogDebug(_T("unhandled VT_ARRAY type %x in wxConvertOleToVariant"), + wxLogDebug(wxT("unhandled VT_ARRAY type %x in wxConvertOleToVariant"), oleVariant.vt & VT_TYPEMASK); variant = wxVariant(); ok = false;