]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/contrib/activex/wxie/wxactivex.cpp
Fix "warning: operation on 'y' may be undefined".
[wxWidgets.git] / wxPython / contrib / activex / wxie / wxactivex.cpp
index 3ef27da80b869aa13c46ee86cb968c9f4aed1b6a..1fb0755413c60535bfb9c9968535236ac7dac0f9 100644 (file)
@@ -317,10 +317,15 @@ void wxActiveX::CreateActiveX(REFCLSID clsid)
     wxCHECK_RET(adviseSink.Ok(), _T("adviseSink not Ok"));
 
 
-    // // Create Object, get IUnknown interface
+    // Create Object, get IUnknown interface
     m_ActiveX.CreateInstance(clsid, IID_IUnknown);
     wxCHECK_RET(m_ActiveX.Ok(), _T("m_ActiveX.CreateInstance failed"));
 
+    // Register object as active
+    unsigned long pdwRegister;
+    hret = RegisterActiveObject(m_ActiveX, clsid, ACTIVEOBJECT_WEAK, &pdwRegister);
+    WXOLE_WARN(hret, "Unable to register object as active");
+
     // Get Dispatch interface
     hret = m_Dispatch.QueryInterface(IID_IDispatch, m_ActiveX); 
     WXOLE_WARN(hret, "Unable to get dispatch interface");
@@ -893,7 +898,7 @@ public:
         {
             // cdecl call
             // sometimes the pDispParams does not match the param info for a activex control
-            int nArg = min(func.params.size(), pDispParams->cArgs);
+            int nArg = wxMin(func.params.size(), pDispParams->cArgs);
             for (int i = nArg - 1; i >= 0; i--)
             {
                 VARIANTARG& va = pDispParams->rgvarg[i];
@@ -908,7 +913,7 @@ public:
 
         if (func.hasOut)
         {
-            int nArg = min(func.params.size(), pDispParams->cArgs);
+            int nArg = wxMin(func.params.size(), pDispParams->cArgs);
             m_activeX->GetEventHandler()->ProcessEvent(event);
             for (int i = 0; i < nArg; i++)
             {