我在“wtypes.h”中找到了一些定义
VT_PTR = 26,
VT_SAFEARRAY = 27,
VT_CARRAY = 28,
VT_USERDEFINED = 29,
VT_LPSTR = 30,
VT_LPWSTR = 31,
* VT_PTR [T] pointer type
* VT_SAFEARRAY [T] (use VT_ARRAY in VARIANT)
* VT_CARRAY [T] C style array
* VT_USERDEFINED [T] user defined type
* VT_LPSTR [T][P] null terminated string
* VT_LPWSTR [T][P] wide null terminated string
在我看来,这个定义表明 Variant 可以作为 ac 数组、ptr 或 c 点。但是当我使用跟随代码将 c 数组传递给 javascript 时无法获取 arg 的类型
STDMETHODIMP CFileSystemObject::Invoke( DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr ){
pVarResult->vt = VT_CARRAY|VT_I4;
pVarResult->pintVal = new int[4];
}
如何将 c 数组从 c++ 传递给 javascript?