wxAutomationObject::wxAutomationObject(WXIDISPATCH* dispatchPtr)
{
m_dispatchPtr = dispatchPtr;
+ m_lcid = LOCALE_SYSTEM_DEFAULT;
}
wxAutomationObject::~wxAutomationObject()
// We rely on the fact that wxBasicString is
// just BSTR with some methods here.
reinterpret_cast<BSTR *>(&argNames[0]),
- 1 + namedArgCount, LOCALE_SYSTEM_DEFAULT, &dispIds[0]);
+ 1 + namedArgCount, m_lcid, &dispIds[0]);
if (FAILED(hr))
{
ShowException(member, hr);
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))
{
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;
if (dispatch)
{
obj.SetDispatchPtr(dispatch);
+ obj.SetLCID(GetLCID());
return true;
}
else
if (dispatch)
{
obj.SetDispatchPtr(dispatch);
+ obj.SetLCID(GetLCID());
return true;
}
else
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,