Important: |
---|
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist. |
When you invoke indexed properties of any dimension, you must pass the indexes as additional parameters.
To set an indexed property, place the new value in the first element of the rgvarg[ ] vector, and the indexes in the subsequent elements.
To get an indexed property, pass the indexes in the first nelements of rgvarg, and the number of indexes in cArg. IDispatch::Invokereturns the value of the property in pVarResult.
Automation stores array data in column-major order, which is the same ordering scheme used by Visual Basic and FORTRAN, but different from C, C++, and Pascal.
If you are programming in C, C++, or Pascal, you must pass the indexes in the reverse order.
The following code example shows how to fill the DISPPARAMSstructure in C++.
Copy Code | |
---|---|
dispparams.rgvarg[0].vt = VT_I2; dispparams.rgvarg[0].iVal = 99; dispparams.rgvarg[1].vt = VT_I2; dispparams.rgvarg[1].iVal = 2; dispparams.rgvarg[2].vt = VT_I2; dispparams.rgvarg[2].iVal = 1; dispparams.rgdispidNamedArgs = DISPID_PROPERTYPUT; dispparams.cArgs = 3; dispparams.cNamedArgs = 1; |
The example changes the value of Prop[1,2] to 99. The new property value is passed in rgvarg[0]. The right-most index is passed in rgvarg[1], and the next index in rgvarg[2]. The cArgsmember specifies the number of elements of rgvarg[ ] that contain data, and cNamedArgsis 1, that indicates the new value for the property.
Property collections are an extension of this functionality.