X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6eefca4fb7793a8d6bc02e69694735cb3e5fc230..eea4d01c65f9b29baa1193db762b4c6b8144af24:/src/msw/ole/automtn.cpp diff --git a/src/msw/ole/automtn.cpp b/src/msw/ole/automtn.cpp index 364608fd6b..12a46ffcad 100644 --- a/src/msw/ole/automtn.cpp +++ b/src/msw/ole/automtn.cpp @@ -88,15 +88,12 @@ bool wxAutomationObject::Invoke(const wxString& member, int action, if (!m_dispatchPtr) return false; - // nonConstMember is necessary because the wxString class doesn't have enough consts... - wxString nonConstMember(member); - - int ch = nonConstMember.Find('.'); + int ch = member.Find('.'); if (ch != -1) { // Use dot notation to get the next object - wxString member2(nonConstMember.Left((size_t) ch)); - wxString rest(nonConstMember.Right(nonConstMember.length() - ch - 1)); + wxString member2(member.Left((size_t) ch)); + wxString rest(member.Right(member.length() - ch - 1)); wxAutomationObject obj; if (!GetObject(obj, member2)) return false; @@ -112,7 +109,7 @@ bool wxAutomationObject::Invoke(const wxString& member, int action, int namedArgCount = 0; int i; for (i = 0; i < noArgs; i++) - if (!INVOKEARG(i).GetName().IsNull()) + if ( !INVOKEARG(i).GetName().empty() ) { namedArgCount ++; } @@ -127,7 +124,7 @@ bool wxAutomationObject::Invoke(const wxString& member, int action, int j = 0; for (i = 0; i < namedArgCount; i++) { - if (!INVOKEARG(i).GetName().IsNull()) + if ( !INVOKEARG(i).GetName().empty() ) { argNames[(namedArgCount-j)] = wxConvertStringToOle(INVOKEARG(i).GetName()); j ++; @@ -548,8 +545,15 @@ bool wxAutomationObject::GetInstance(const wxString& progId, int flags) const } else { - wxLogSysError(hr, - _("Cannot get an active instance of \"%s\""), progId); + // Log an error except if we're supposed to fail silently when the + // error is that no current instance exists. + if ( hr != MK_E_UNAVAILABLE || + !(flags & wxAutomationInstance_SilentIfNone) ) + { + wxLogSysError(hr, + _("Cannot get an active instance of \"%s\""), + progId); + } } return false;