Поделиться через


METHOD_PROLOGUE

Maintains the proper global state when calling methods of an exported interface.

METHOD_PROLOGUE(theClass, localClass )

Parameters

  • theClass
    Specifies the name of the class whose interface map is being implemented.

  • localClass
    Specifies the name of the local class that implements the interface map.

Remarks

Typically, member functions of interfaces implemented by CCmdTarget-derived objects already use this macro to provide automatic initialization of the pThis pointer. For example:

class CMySink : public CCmdTarget
{
public:
   CMySink();
   ~CMySink() {};

protected:
   DECLARE_INTERFACE_MAP()

   // The following block declares an inner class called 'XSinky'
   BEGIN_INTERFACE_PART(Sinky, ISampleSink)
      STDMETHOD(SinkFunc)();
   END_INTERFACE_PART(Sinky)
};
STDMETHODIMP_(ULONG) CMySink::XSinky::AddRef()
{
   METHOD_PROLOGUE(CMySink, Sinky);
   return pThis->InternalAddRef();
}

Requirements

Header: afxwin.h

See Also

Concepts

MFC Macros and Globals

TN038: MFC/OLE IUnknown Implementation

Creating New Documents, Windows, and Views