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


METHOD_PROLOGUE

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

METHOD_PROLOGUE(theClass, localClass )

Параметры

  • 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.

Заметки

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();
}

Требования

Header: afxwin.h

См. также

Основные понятия

MFC Macros and Globals

TN038: MFC/OLE IUnknown Implementation

Creating New Documents, Windows, and Views