Partager via


IDispatchEx::DeleteMemberByDispID

Deletes a member by DISPID.

Syntax

HRESULT DeleteMemberByDispID(  
    DISPID id  
);  

Parameters

id
Member identifier. Uses GetDispID or GetNextDispID to obtain the dispatch identifier.

Return Value

Returns one of the following values:

S_OK Success.
S_FALSE Member exists but cannot be deleted.

Remarks

If the member is deleted, the DISPID needs to remain valid for GetNextDispID.

If a member with a given name is deleted and later a member with the same name is recreated, the DISPID should be the same. (Whether member names that differ only by case are the "same" is object-dependent.)

Example

BSTR bstrName;  
DISPID dispid;  
IDispatchEx *pdex;   
  
// Assign to pdex and bstrName  
if (SUCCEEDED(pdex->GetDispID(bstrName, fdexNameCaseSensitive, &dispid)))  
    pdex->DeleteMemberByDispID(dispid);  

See also

IDispatchEx Interface
IDispatchEx::GetDispID
IDispatchEx::GetNextDispID