setting an excel column to autofit using c++ and com automation fails
See the question and my original answer on StackOverflowThe IDispatch::Invoke method is documented like this:
[in, out] pDispParams
Pointer to a DISPPARAMS structure containing an array of arguments, an array of argument DISPIDs for named arguments, and counts for the number of elements in the arrays.
It doesn't say the pDispParams
can be null, while it does say it can for other parameters in the same method (it happens that documentation is not complete...).
So, for no parameters, you must allocate at least a zeroed DISPPARAMS structure.
PS: it's actually surprising that the method implementation doesn't validate against null (and return E_INVALIDARG or E_POINTER), it's usually how its done in the Windows API.