bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs = 0, wxVariant args[] = NULL) const;
bool GetObject(wxAutomationObject& obj, const wxString& property, int noArgs, const wxVariant **args) const;
-public:
+ // Returns the locale identifier used in automation calls. The default is
+ // LOCALE_SYSTEM_DEFAULT. Objects obtained by GetObject() inherit the
+ // locale identifier from the one that created them.
+ LCID GetLCID() const;
+
+ // Sets the locale identifier to be used in automation calls performed by
+ // this object. The default is LOCALE_SYSTEM_DEFAULT.
+ void SetLCID(LCID lcid);
+
+public: // public for compatibility only, don't use m_dispatchPtr directly.
WXIDISPATCH* m_dispatchPtr;
+private:
+ LCID m_lcid;
+
wxDECLARE_NO_COPY_CLASS(wxAutomationObject);
};
You may need to cast from IDispatch* to WXIDISPATCH* when calling this function.
*/
void SetDispatchPtr(WXIDISPATCH* dispatchPtr);
+
+ /**
+ Returns the locale identifier used in automation calls.
+
+ The default is LOCALE_SYSTEM_DEFAULT but the objects obtained by
+ GetObject() inherit the locale identifier from the one that created
+ them.
+
+ @since 2.9.5
+ */
+ LCID GetLCID() const;
+
+ /**
+ Sets the locale identifier to be used in automation calls performed by
+ this object.
+
+ The default value is LOCALE_SYSTEM_DEFAULT.
+
+ Notice that any automation objects created by this one inherit the same
+ LCID.
+
+ @since 2.9.5
+ */
+ void SetLCID(LCID lcid);
+
};
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))
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,