Export (0) Print
Expand All

DispGetIDsOfNames function

Low-level helper for Invoke that provides machine independence for customized Invoke.

Syntax


HRESULT DispGetIDsOfNames(
  ITypeInfo *ptinfo,
  _In_   OLECHAR **rgszNames,
  UINT cNames,
  _Out_  DISPID *rgdispid
);

Parameters

ptinfo

The type information for an interface. This type information is specific to one interface and language code, so it is not necessary to pass an interface identifier (IID) or LCID to this function.

rgszNames [in]

An array of name strings that can be the same array passed to DispInvoke in the DISPPARAMS structure. If cNames is greater than 1, the first name is interpreted as a method name, and subsequent names are interpreted as parameters to that method.

cNames

The number of elements in rgszNames.

rgdispid [out]

An array of DISPIDs to be filled in by this function. The first ID corresponds to the method name. Subsequent IDs are interpreted as parameters to the method.

Return value

Return codeDescription
S_OK

The interface is supported.

E_INVALIDARG

One of the parameters is not valid.

DISP_E_UNKNOWNNAME

One or more of the specified names were not known. The returned array of DISPIDs contains DISPID_UNKNOWN for each entry that corresponds to an unknown name.

 

Any of the ITypeInfo::Invoke errors can also be returned.

Examples

This code from the Lines sample file Points.cpp implements the member function GetIDsOfNames for the CPoints class using DispGetIDsOfNames. This implementation relies on DispGetIdsOfNames to validate input arguments. To help minimize security risks, include code that performs more robust validation of the input arguments.


STDMETHODIMP
CPoints::GetIDsOfNames(
      REFIID riid,
      char ** rgszNames,
      UINT cNames,
      LCID lcid,
      DISPID * rgdispid)
{
   return DispGetIDsOfNames(m_ptinfo, rgszNames, cNames, rgdispid);
}

Requirements

Header

OleAuto.h

Library

OleAut32.lib

DLL

OleAut32.dll

 

 

Community Additions

ADD
Show:
© 2014 Microsoft