Visual Studio Developer Center > Visual Studio Forums > Visual Studio Extensibility > In IExtenderProvider::CanExtend(), how to query (IDispatch*)pdispExtendeeObject?
Ask a questionAsk a question
 

QuestionIn IExtenderProvider::CanExtend(), how to query (IDispatch*)pdispExtendeeObject?

  • Monday, November 02, 2009 5:06 PMgg3 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I've got an unmanaged, C++ VsPackage that implements an ExtenderProvider, such that the VS IDE is calling my CanExtend() method when I select the appropriate type of object in Solution Explorer.

    I want to inspect the Extendee instance to determine whether or not I should provide an Extender for it.  I understand that the Extendee instance is represented by the "IDispatch* pdispExtendeeObject" argument to CanExtend(), but I'm not sure what to do with this object.  How can I determine the name of the item, as displayed in Solution Explorer?  More generally, how can I tell what properties/attributes/methods this object supports, and how can I then invoke those properties/attributes/methods?

All Replies

  • Tuesday, November 03, 2009 9:10 PMgg3 Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Has Code

    This seems to be the way to determine the name of the item, as displayed in Solution Explorer:

    STDMETHODIMP CIMSolnExtenderProvider::CanExtend(
    	/* [in]          */ BSTR            bstrExtenderCATID, 
    	/* [in]          */ BSTR            bstrExtenderName, 
    	/* [in]          */ IDispatch *     pdispExtendeeObject, 
    	/* [out, retval] */ VARIANT_BOOL *  pfRetval)
    {
    	// ...
    	CComDispatchDriver cddExtendee(pdispExtendeeObject);
    	CComVariant cvarName;
    	hr = cddExtendee.GetPropertyByName(L"Name",&cvarName);
    
    	// ...
    };
    
    Still not sure how I can tell what other properties/attributes/methods this object supports...