다음을 통해 공유


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. 예를 들면 다음과 같습니다.

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

요구 사항

헤더: afxwin.h

참고 항목

개념

MFC 매크로 및 전역

TN038: MFC/OLE IUnknown 구현

새 문서, 창 및 뷰 만들기