X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e28985499b2e69531fdf6b562fdb143ec6441b8c..65fd2fc2616552e4204223b7c2b69d9bc87c1f2d:/src/msw/ole/automtn.cpp diff --git a/src/msw/ole/automtn.cpp b/src/msw/ole/automtn.cpp index 1bccfebca1..0a80f775cb 100644 --- a/src/msw/ole/automtn.cpp +++ b/src/msw/ole/automtn.cpp @@ -13,21 +13,26 @@ #include "wx/wxprec.h" #if defined(__BORLANDC__) -#pragma hdrstop + #pragma hdrstop #endif -#include "wx/defs.h" - -// Watcom C++ gives a linker error if this is compiled in. // With Borland C++, all samples crash if this is compiled in. -#if wxUSE_OLE && !(defined(__BORLANDC__) && (__BORLANDC__ < 0x520)) && !defined(__CYGWIN10__) +#if (defined(__BORLANDC__) && (__BORLANDC__ < 0x520)) || defined(__CYGWIN10__) + #undef wxUSE_OLE_AUTOMATION + #define wxUSE_OLE_AUTOMATION 0 +#endif + +#if wxUSE_OLE_AUTOMATION + +#ifndef WX_PRECOMP + #include "wx/log.h" + #include "wx/math.h" +#endif #define _FORCENAMELESSUNION -#include "wx/log.h" #include "wx/msw/private.h" #include "wx/msw/ole/oleutils.h" #include "wx/msw/ole/automtn.h" -#include "wx/math.h" #ifdef __WXWINCE__ #include "wx/msw/wince/time.h" @@ -49,7 +54,7 @@ #if wxUSE_DATETIME #include "wx/datetime.h" -#endif // wxUSE_TIMEDATE +#endif // wxUSE_DATETIME static void ClearVariant(VARIANTARG *pvarg) ; static void ReleaseVariant(VARIANTARG *pvarg) ; @@ -90,7 +95,7 @@ bool wxAutomationObject::Invoke(const wxString& member, int action, { // Use dot notation to get the next object wxString member2(nonConstMember.Left((size_t) ch)); - wxString rest(nonConstMember.Right(nonConstMember.Length() - ch - 1)); + wxString rest(nonConstMember.Right(nonConstMember.length() - ch - 1)); wxAutomationObject obj; if (!GetObject(obj, member2)) return false; @@ -493,7 +498,7 @@ bool wxAutomationObject::GetInstance(const wxString& classId) const CLSID clsId; IUnknown * pUnk = NULL; - wxBasicString unicodeName(classId.mb_str()); + wxBasicString unicodeName(classId); if (FAILED(CLSIDFromProgID((BSTR) unicodeName, &clsId))) { @@ -525,7 +530,7 @@ bool wxAutomationObject::CreateInstance(const wxString& classId) const CLSID clsId; - wxBasicString unicodeName(classId.mb_str()); + wxBasicString unicodeName(classId); if (FAILED(CLSIDFromProgID((BSTR) unicodeName, &clsId))) { @@ -595,11 +600,11 @@ WXDLLEXPORT bool wxConvertVariantToOle(const wxVariant& variant, VARIANTARG& ole { wxDateTime date( variant.GetDateTime() ); oleVariant.vt = VT_DATE; - + long dosDateTime = date.GetAsDOS(); short dosDate = short((dosDateTime & 0xFFFF0000) >> 16); short dosTime = short(dosDateTime & 0xFFFF); - + DosDateTimeToVariantTime(dosDate, dosTime, & oleVariant.date); } #endif @@ -682,8 +687,8 @@ WXDLLEXPORT bool wxConvertOleToVariant(const VARIANTARG& oleVariant, wxVariant& unsigned short dosDate = 0; unsigned short dosTime = 0; VariantTimeToDosDateTime(oleVariant.date, & dosDate, & dosTime); - - long dosDateTime = (dosDate << 16) || dosTime; + + long dosDateTime = (dosDate << 16) | dosTime; wxDateTime date; date.SetFromDOS(dosDateTime); variant = date; @@ -799,7 +804,7 @@ static void ReleaseVariant(VARIANTARG *pvarg) { VARTYPE vt; VARIANTARG _huge *pvargArray; - long lLBound, lUBound, l; + LONG lLBound, lUBound, l; vt = (VARTYPE)(pvarg->vt & 0xfff); // mask off flags @@ -851,9 +856,11 @@ static void ReleaseVariant(VARIANTARG *pvarg) break; case VT_I2: + case VT_I4: case VT_BOOL: case VT_R8: case VT_ERROR: // to avoid erroring on an error return from Excel + case VT_EMPTY: // no work for these types break; @@ -929,4 +936,4 @@ void ShowException(LPOLESTR szMember, HRESULT hr, EXCEPINFO *pexcep, unsigned in #endif -#endif // wxUSE_OLE && !(defined(__BORLANDC__) && (__BORLANDC__ < 0x520)) && !defined(__CYGWIN10__) +#endif // wxUSE_OLE_AUTOMATION