Partager via


CCmdTarget::GetIDispatch

Call this member function to retrieve the IDispatch pointer from an automation method that either returns an IDispatch pointer or takes an IDispatch pointer by reference.

LPDISPATCH GetIDispatch(
   BOOL bAddRef 
);

Parameters

  • bAddRef
    Specifies whether to increment the reference count for the object.

Return Value

The IDispatch pointer associated with the object.

Remarks

For objects that call EnableAutomation in their constructors, making them automation enabled, this function returns a pointer to the Foundation Class implementation of IDispatch that is used by clients who communicate via the IDispatch interface. Calling this function automatically adds a reference to the pointer, so it is not necessary to make a call to IUnknown::AddRef.

Requirements

Header: afxwin.h

See Also

Reference

CCmdTarget Class

Hierarchy Chart

CCmdTarget::EnableAutomation

COleDispatchDriver Class

IUnknown::Release

Other Resources

CCmdTarget Members