Maps a single member name to its corresponding DISPID, which can then be used on subsequent calls to IDispatchEx::InvokeEx.
HRESULT GetDispID( BSTR bstrName, DWORD grfdex, DISPID *pid );
Returns one of the following values:
|
S_OK |
Success. |
|
E_OUTOFMEMORY |
Out of Memory. |
|
DISP_E_UNKNOWNNAME |
The name was not known. |
GetDispID can be used instead of GetIDsOfNames to obtain the DISPID for a given member.
Because IDispatchEx allows the addition and deletion of members, the set of DISPIDs does not remain constant for the lifetime of an object.
The unused riid parameter in IDispatch::GetIDsOfNames has been removed.
BSTR bstrName; DISPID dispid; IDispatchEx *pdex; // Assign to pdex and bstrName pdex->GetDispID(bstrName, fdexNameCaseSensitive, &dispid); // Use dispid
