]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/ole/automtn.cpp
fixes to ShowFullScreen (KDE 3.1)
[wxWidgets.git] / src / msw / ole / automtn.cpp
index 44ddb88ab90999aa85a3575d3a11144c9ee12185..9596ceea35f532800860a70a90a35577cbc41574 100644 (file)
@@ -26,6 +26,7 @@
 // With Borland C++, all samples crash if this is compiled in.
 #if wxUSE_OLE &&!defined(__WATCOMC__) && !(defined(__BORLANDC__) && (__BORLANDC__ < 0x520)) && !defined(__CYGWIN10__)
 
+#define _FORCENAMELESSUNION
 #include "wx/log.h"
 #include "wx/msw/ole/automtn.h"
 #include "wx/msw/private.h"
@@ -183,6 +184,8 @@ bool wxAutomationObject::Invoke(const wxString& member, int action,
        if (FAILED(hr)) 
        {
 //             ShowException(szMember, hr, NULL, 0);
+           delete[] argNames;
+           delete[] dispIds;
                return FALSE;
        }
 
@@ -201,7 +204,12 @@ bool wxAutomationObject::Invoke(const wxString& member, int action,
        {
                // Again, reverse args
                if (!ConvertVariantToOle(INVOKEARG((noArgs-1) - i), oleArgs[i]))
-                       return FALSE; // TODO: clean up memory at this point
+        {
+               delete[] argNames;
+               delete[] dispIds;
+            delete[] oleArgs;
+                       return FALSE;
+        }
        }
 
        dispparams.rgdispidNamedArgs = dispIds + 1;
@@ -588,16 +596,20 @@ bool ConvertVariantToOle(const wxVariant& variant, VARIANTARG& oleVariant)
 
     wxString type(variant.GetType());
 
-               if (type == wxT("char"))
-               {
-                       oleVariant.vt=VT_I1;                    // Signed Char
-                       oleVariant.cVal=variant.GetChar();
-               }
-    else if (type == wxT("long"))
+
+    if (type == wxT("long"))
     {
         oleVariant.vt = VT_I4;
         oleVariant.lVal = variant.GetLong() ;
     }
+    // cVal not always present
+#ifndef __GNUWIN32__
+    else if (type == wxT("char"))
+    {
+        oleVariant.vt=VT_I1;                   // Signed Char
+        oleVariant.cVal=variant.GetChar();
+    }
+#endif
     else if (type == wxT("double"))
     {
         oleVariant.vt = VT_R8;
@@ -829,12 +841,15 @@ static BSTR ConvertStringToOle(const wxString& str)
 
 static wxString ConvertStringFromOle(BSTR bStr)
 {
+#if wxUSE_UNICODE
+    wxString str(bStr);
+#else
        int len = SysStringLen(bStr) + 1;
        char    *buf = new char[len];
        (void)wcstombs( buf, bStr, len);
-
-       wxString str(buf);
+       wxString str(buf); 
        delete[] buf;
+#endif
        return str;
 }