0 out of 6 rated this helpful Rate this topic

CComDispatchDriver 

This class manages COM interface pointers.


typedef CComQIPtr<IDispatch, &__uuidof(IDispatch)> CComDispatchDriver;

Header: atlbase.h

Reference

CComQIPtr Class

Other Resources

ATL Typedefs

Did you find this helpful?
(2000 characters remaining)
Community Content Add
Annotations FAQ
Remarks

Specialized template class CComPtr<IDispatch> provides helper methods for easy calling IDispatch methods. CComDispatchDriver can be used for making IDispatch Invoke calls.

Example:

 // assumption: IUnknown *dteSolution;  is initialized to an IUnknown pointer to an object with defined property 
 // named DTE 
 ...

 ATL::CComDispatchDriver disp;
HRESULT hr = dteSolution->QueryInterface(&disp);
DISPID dtePropID;
hr = disp.GetIDOfName(L"DTE", &dtePropID);
ATL::CComVariant vtDTE;
hr = disp.GetProperty(dtePropID, &vtDTE);


Note: error handling removed for brevity.