DispGetIDsOfNames Function
Uses type information to convert a set of names to DISPIDs. This is the recommended implementation of IDispatch::GetIDsOfNames.
HRESULT DispGetIDsOfNames( ITypeInfo* ptinfo, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, DISPID FAR* rgdispid );
The return value obtained from the returned HRESULT is one of the following:
Return value | Meaning |
|---|---|
S_OK | The interface is supported. |
E_INVALIDARG | One of the arguments is invalid. |
DISP_E_UNKNOWNNAME | One or more of the given names were not known. The returned array of DISPIDs contains DISPID_UNKNOWN for each entry that corresponds to an unknown name. |
Other return codes | Any of the ITypeInfo::Invoke errors can also be returned. |
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 FAR* FAR* rgszNames,
UINT cNames,
LCID lcid,
DISPID FAR* rgdispid)
{
return DispGetIDsOfNames(m_ptinfo, rgszNames, cNames, rgdispid);
}