Goes like this: data for safearay will come from a vec, so there has to be a
handle to a vec in the approrpiate pisition in param list.
If no typespec, but vec handle found, safearray assumes, 1D, same size as vec
provided, 1d or 2d depending on dimensionality of vec, lower bound 0, #
elementsin each dimension same as dimensions of vec, type VT_VARIANT, type
within VARIANTS guessed.
Typecode for a safearray is "y"
-- The character after the type code is required and specifies whether the
parameter is to be passed by reference ("r") or by value ("v" or blank). In
most cases you'll be passing by value.
-- The character after the reference/value indicator is required and is the
type of the array elements, and may be any of type codes above except "y" (i.e.
you can't have a safearray of safearrays). The may also specify a blank,
meaning safearray elements are to be VT_VARIANT.
(a SAFEARRAY can be an array of anything. Generally stuff in the VB/VBA
(therefore Office)/VBS world require SAFEARRAYS to contain VARIANTS, so
VT_VARIANT aka blank is usually the right answer)
-- If (and only if) the type of array elements is specified by a blank
(therefore VT_VARIANT), the next character is required and taken to be the type
of each VT_VARIANT, i.e. for value of vt for each VARIANT in the array. If
blank, the type of data will be guessed at from the provided data.
-- If the next (optional) character is 0 or 1, it's taken to be the lower bound
of all dimensions
(if omitted, will assume lb of 0)
-- If the next character is an underscore followed by digits, the digits
following (up to the next non-digit) is taken to be the number of elements in
the first dimension of the safearray. This rule is applied repleatedly and
therefore determines the number of dimensions as well as the length of each.
So these would be legit
"y " (array, pass by val, VT_VARIANTs in array, type of VARIANTs
guessed)
"yv s" (array, pass by val, VT_VARIANTs in array,
BSTRs in VARIANTS)
"y 1_5_4" (array, pass by val, VT_VARIANTs in array, type of
VARIANTs guessed, 2D SAFEARRAY, 3 X 4, lbound 1 for
both dimensions)
One thing I was thinking of messing with is whether dimensions need to be
transposed; but that's getting a bit fussy, I think I'll just require work out
how the data has to be laid out in vec to end up right way round in SAFEARRAY.