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.
A version of this page is also available for
4/8/2010

IDispatch::Invokereturns DISP_E_MEMBERNOTFOUND if one of the following conditions occurs:

  • A member or parameter with the specified DISPID and matching cArgscannot be found ,and the parameter is not optional.

  • The member is a void function, and the caller did not set pVarResultto NULL.

  • The member is a read-only property, and the caller set wFlagsto DISPATCH_PROPERTYPUT or DISPATCH_PROPERTYPUTREF.

If Invokefinds the member, but uncovers errors in the parameter list, it returns one of several other errors. DISP_E_BAD_PARAMCOUNT means that the DISPPARAMSstructure contains an incorrect number of parameters for the property or method. DISP_E_NONAMEDARGS means that Invokereceived named parameters, but they are not supported by the member.

DISP_E_PARAMNOTFOUND means that the correct number of parameters was passed, but the DISPID for one or more parameters was incorrect. If Invokecannot convert one of the parameters to the desired type, it returns DISP_E_TYPEMISMATCH.

In these two cases, if it can identify which parameter is incorrect, Invokesets * puArgErrto the index within rgvargof the parameter with the error. For example, if an Automation method expects a reference to a double-precision number as a parameter, but receives a reference to an integer, the parameter is coerced.

However, if the method receives a date, Invokereturns DISP_E_TYPEMISMATCH and sets *puArgErrto the index of the integer in the parameter array.

Automation provides functions to perform standard conversions of VARIANT, and these functions should be used for consistent operation. DISP_E_TYPEMISMATCH is returned only when these functions fail.

See Also