title: Read and display data from Variant VT_ARRAY | VT_BSTR?
body: <p>I want to use an instrument that has a COM object interface. Unfortunately there is no C++ example in the SDK, only C#.</p>
  
  <p>After creating the wrapper class, I can successfully read the instrument's serial number into a VARIANT:</p>
  
  <pre><code> VARIANT snumbers;
   PowerMeter=new TCoLMMeasurement(Form1);
   PowerMeter-&gt;ScanUSB(&amp;snumbers);
  </code></pre>
  
  <p>However I am not able to get the serial number out properly from the VARIANT that has a (VT_ARRAY | VT_BSTR) type.
  I read the documentation of the type, here is what I tried and what I got:</p>
  
  <pre><code>info("type of data: " + AnsiString(snumbers.vt));
  info("VT_ARRAY|VT_BSTR = " + AnsiString(VT_ARRAY |VT_BSTR));
  info("Size of an element(bytes): " + AnsiString(snumbers.parray-&gt;cbElements));
  info("Number of dimensions: " + AnsiString(snumbers.parray-&gt;cDims));
  info("Size of dimension 0: " + AnsiString(snumbers.parray-&gt;rgsabound[0].cElements));
  info("value of pVdata[0]: " + AnsiString(((long*)(snumbers.parray-&gt;pvData))[0]));
  info(((long*)snumbers.bstrVal)[0]);
  
  SAFEARRAY* pSafeArray=NULL;
  pSafeArray=V_ARRAY(&amp;snumbers);
  long element=0;
  long i=0;
  SafeArrayGetElement(pSafeArray,&amp;i,(void*)&amp;element);
  info(element);
  </code></pre>
  
  <p>The above code displays these results:</p>
  
  <pre><code>type of data: 8200
  VT_ARRAY|VT_BSTR = 8200
  Size of an element(bytes): 4
  Number of dimensions: 1
  Size of dimension 0: 1
  value of pVdata[0]: 1591532
  25165825
  1592716
  </code></pre>
  
  <p>The serial number should be 700187.</p>
  
  <p>I made the testint in a VCL forms application created with CodeGear RAD C++ Builder 2007 </p>
  
  <p>Thanks for any kind of help!</p>
  
  <p>Gaszton</p>