X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/5d8cdb5d1c072744f8178fc9579ba2c81e35dda9..3988b3e819a2e336b8fcd90214c949f61069279b:/src/msw/ole/automtn.cpp diff --git a/src/msw/ole/automtn.cpp b/src/msw/ole/automtn.cpp index 10e9063a73..369dfec16f 100644 --- a/src/msw/ole/automtn.cpp +++ b/src/msw/ole/automtn.cpp @@ -70,6 +70,7 @@ ShowException(const wxString& member, wxAutomationObject::wxAutomationObject(WXIDISPATCH* dispatchPtr) { m_dispatchPtr = dispatchPtr; + m_lcid = LOCALE_SYSTEM_DEFAULT; } wxAutomationObject::~wxAutomationObject() @@ -161,7 +162,7 @@ bool wxAutomationObject::Invoke(const wxString& member, int action, // We rely on the fact that wxBasicString is // just BSTR with some methods here. reinterpret_cast(&argNames[0]), - 1 + namedArgCount, LOCALE_SYSTEM_DEFAULT, &dispIds[0]); + 1 + namedArgCount, m_lcid, &dispIds[0]); if (FAILED(hr)) { ShowException(member, hr); @@ -194,7 +195,7 @@ bool wxAutomationObject::Invoke(const wxString& member, int action, EXCEPINFO excep; wxZeroMemory(excep); - hr = ((IDispatch*)m_dispatchPtr)->Invoke(dispIds[0], IID_NULL, LOCALE_SYSTEM_DEFAULT, + hr = ((IDispatch*)m_dispatchPtr)->Invoke(dispIds[0], IID_NULL, m_lcid, (WORD)action, &dispparams, vReturnPtr, &excep, &uiArgErr); if (FAILED(hr)) @@ -221,6 +222,12 @@ bool wxAutomationObject::Invoke(const wxString& member, int action, { vReturn.pdispVal = NULL; } + // Mustn't free the SAFEARRAY if it is contained in the retValue + if ((vReturn.vt & VT_ARRAY) && + retValue.GetType() == wxS("safearray")) + { + vReturn.parray = NULL; + } } } return true; @@ -467,6 +474,7 @@ bool wxAutomationObject::GetObject(wxAutomationObject& obj, const wxString& prop if (dispatch) { obj.SetDispatchPtr(dispatch); + obj.SetLCID(GetLCID()); return true; } else @@ -480,6 +488,7 @@ bool wxAutomationObject::GetObject(wxAutomationObject& obj, const wxString& prop if (dispatch) { obj.SetDispatchPtr(dispatch); + obj.SetLCID(GetLCID()); return true; } else @@ -589,6 +598,16 @@ bool wxAutomationObject::CreateInstance(const wxString& progId) const return m_dispatchPtr != NULL; } +LCID wxAutomationObject::GetLCID() const +{ + return m_lcid; +} + +void wxAutomationObject::SetLCID(LCID lcid) +{ + m_lcid = lcid; +} + static void ShowException(const wxString& member, HRESULT hr,