TurboCAD Forums

The Ultimate Resource for TurboCAD Knowledge

Register
 
All posts discussing pricing or where to buy TurboCAD will be deleted.

Can I use a COleSafeArray as a property? I can add it but I can't get it back.
Read 1100 times
* December 24, 2014, 09:44:08 AM
In the following code "res = pData->get_Value(0,&varValue);" returns E_FAIL.


HRESULT SetProperty (IGraphic* pGraphic, CString Name, COleSafeArray value, COleVariant ReadOnly )
{
   if (pGraphic==(IGraphic*)NULL) return E_POINTER;
   Properties* pProp = NULL;
   HRESULT res = pGraphic->get_Properties(&pProp);
   if (SUCCEEDED(res))
   {
      Property* pData = NULL;
      res = pProp->get_Item(COleVariant(Name),&pData);
      if (SUCCEEDED(res))
      {
         pData->put_Value(0, value);
         pData->Release();
         return res;
      }
      res = pProp->Add(Name.AllocSysString(),&value,&ReadOnly,varMissed,&pData);
      if (SUCCEEDED(res))
      {
         // test
         COleSafeArray varValue;
         res = pData->get_Value(0,&varValue);
         pData->Release();
      }
      pProp->Release();
   }
   return res;
}

Logged