ITypeInfo.Invoke(Object, Int32, Int16, DISPPARAMS, IntPtr, IntPtr, Int32) 方法

定义

调用对象的方法或访问对象的属性,该方法或属性实现由类型说明描述的接口。Invokes a method, or accesses a property of an object, that implements the interface described by the type description.

public:
 void Invoke(System::Object ^ pvInstance, int memid, short wFlags, System::Runtime::InteropServices::ComTypes::DISPPARAMS % pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, [Runtime::InteropServices::Out] int % puArgErr);
public void Invoke (object pvInstance, int memid, short wFlags, ref System.Runtime.InteropServices.ComTypes.DISPPARAMS pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, out int puArgErr);
abstract member Invoke : obj * int * int16 * DISPPARAMS * nativeint * nativeint * int -> unit
Public Sub Invoke (pvInstance As Object, memid As Integer, wFlags As Short, ByRef pDispParams As DISPPARAMS, pVarResult As IntPtr, pExcepInfo As IntPtr, ByRef puArgErr As Integer)

参数

pvInstance
Object

对由此类型说明描述的接口的引用。A reference to the interface described by this type description.

memid
Int32

用于标识接口成员的值。A value that identifies the interface member.

wFlags
Int16

描述 Invoke 调用的上下文的标志。Flags that describe the context of the invoke call.

pDispParams
DISPPARAMS

对结构的引用,该结构包含一个参数数组、一个命名参数的 DISPID 数组和每个数组中元素数的计数。A reference to a structure that contains an array of arguments, an array of DISPIDs for named arguments, and counts of the number of elements in each array.

pVarResult
IntPtr

对用于存储结果的位置的引用。A reference to the location at which the result is to be stored. 如果 wFlags 指定 DISPATCH_PROPERTYPUTDISPATCH_PROPERTYPUTREF,则忽略 pVarResultIf wFlags specifies DISPATCH_PROPERTYPUT or DISPATCH_PROPERTYPUTREF, pVarResult is ignored. 如果不需要任何结果,则设置为 nullSet to null if no result is desired.

pExcepInfo
IntPtr

指向异常信息结构的指针,该结构仅在返回 DISP_E_EXCEPTION 时才被填充。A pointer to an exception information structure, which is filled in only if DISP_E_EXCEPTION is returned.

puArgErr
Int32

如果 Invoke 返回 DISP_E_TYPEMISMATCHpuArgErr 则指示具有错误类型的参数的 rgvarg 中的索引。If Invoke returns DISP_E_TYPEMISMATCH, puArgErr indicates the index within rgvarg of the argument with the incorrect type. 如果多个参数返回错误,则 puArgErr 仅指示第一个具有错误的参数。If more than one argument returns an error, puArgErr indicates only the first argument with an error. 此参数未经初始化即被传递。This parameter is passed uninitialized.

注解

pDispParams可以通过方法访问参数的值 PtrToStructureThe values of the pDispParams parameter can be accessed through the PtrToStructure method.

参数的有效值为 wFlagsValid values for the wFlags parameter are:

ValueValue 说明Description
DISPATCH_METHODDISPATCH_METHOD 作为方法访问成员。The member is accessed as a method. 如果存在多义性,则可以同时设置此标志和 DISPATCH_PROPERTYGET 标志。If there is ambiguity, both this flag and the DISPATCH_PROPERTYGET flag can be set.
DISPATCH_PROPERTYGETDISPATCH_PROPERTYGET 成员作为属性或数据成员来检索。The member is retrieved as a property or data member.
DISPATCH_PROPERTYPUTDISPATCH_PROPERTYPUT 成员作为属性或数据成员进行更改。The member is changed as a property or data member.
DISPATCH_PROPERTYPUTREFDISPATCH_PROPERTYPUTREF 使用引用赋值而不是值赋值来更改成员。The member is changed by using a reference assignment, rather than a value assignment. 仅当属性接受对对象的引用时,此值才有效。This value is valid only when the property accepts a reference to an object.

有关详细信息,请参阅 ITypeInfo:: Invoke 方法For more information, see ITypeInfo::Invoke method.

适用于