void Create( VARTYPE vtSrc, DWORD dwDims, DWORD* rgElements );英文不好,MSDN上vtSrc的内容是:The base type of the array (that is, the VARTYPE of each element of the array). The VARTYPE is restricted to a subset of the variant types. Neither the VT_ARRAY nor the VT_BYREF flag can be set. VT_EMPTY and VT_NULL are not valid base types for the array. All other types are legal.这参数起什么作用?如果设置为VT_R8和VT_R4有什么区别?谢谢!!
就是数组是个double型数组VT_R4
数组是float型。
一个占8字节,一个占4字节。
我看的是微软的vc操作excel中的例子,COleSafeArray会用来保存好几种数据类型的数据,这时第一个变量如何选择?
COleSafeArray m_saData;
......
range = sheet.GetRange(COleVariant("A1"), COleVariant("C5")); //返回LPDISPATCHret = range.GetValue(oleData); numElements[0]= 5; // 在objRange中的行数.
numElements[1]= 3; // 在objRange中的列数.
m_saData.Create(VT_R8, 2, numElements);
m_saData = ret;......
这样m_saData中就保存了excel中A,B,C三列的数据,行数为5,这三列的数据类型不一样。其中的Create是我添加的,我认为应该有的范围,只是参数VT_R8是我乱摘了一个进去。