When the end user deletes a method or property, you use the DeleteFuncDesc (or DeleteFuncDescByMemId) or DeleteVarDesc (or DeleteVarDescByMemId) method in the ICreateTypeInfo2 interface to remove its type description These methods are described in the Automation Programmer's Reference.
If you know the index for the property or method in the type information, use DeleteFuncDesc or DeleteVarDesc. These methods take one parameter, index, which supplies the index into the type information.
If you don't know the index but know the name of the property or method, you can use DeleteFuncDescByMemId or DeleteVarDescByMemId instead. These two methods require the member identifier (MEMBERID) of the property or method and its INVKIND, which is either INVOKE_PROPERTYGET or INVOKE_FUNC.
The MEMBERID is available through the object's ITypeComp interface, as in the following example. (Error handling is omitted for brevity.)
hr = m_pRuntimeTypeInfo->QueryInterface(IID_ITypeInfo, (void **)&ptiTemp); hr = ptiTemp->GetTypeComp(&pTypeComp);
After getting a pointer to the object's ITypeComp interface, you use the Bind method to map the subobject's name to its type information. In the following code fragment, the variable pwsz represents the name of the subobject.
hr = pTypeComp->Bind(pwsz, LHashValOfNameSys(SYS_WIN32, g_lcidLocale, pwsz), INVOKE_PROPERTYGET, &ptiTemp, &dk, &bp);
Next, get the MEMBERID from the function descriptor and release the reference to ITypeComp:
memid = bp.lpfuncdesc->memid; pTypeComp->Release();
Finally, with the MEMBERID in memid, call DeleteFuncDescByMemId to delete the function.
hr = m_pRuntimeTypeInfo->DeleteFuncDescByMemId(memid, INVOKE_PROPERTYGET);