Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Note
The Microsoft Foundation Classes (MFC) library continues to be supported. However, we're no longer adding features or updating the documentation.
For member functions of a COM interface, use the METHOD_PROLOGUE macro to maintain the proper global state when calling methods of an exported interface.
Typically, member functions of interfaces implemented by CCmdTarget-derived objects already use this macro to provide automatic initialization of the pThis pointer. For example:
STDMETHODIMP_(ULONG) CMySink::XSinky::AddRef()
{
METHOD_PROLOGUE(CMySink, Sinky);
return pThis->InternalAddRef();
}
For additional information, see Technical Note 38 on MFC/OLE IUnknown implementation.
The METHOD_PROLOGUE macro is defined as:
#define METHOD_PROLOGUE(theClass, localClass) \
theClass* pThis = \
((theClass*)((BYTE*)this - offsetof(theClass, m_x##localClass))); \
AFX_MANAGE_STATE(pThis->m_pModuleState) \
The portion of the macro concerned with managing the global state is:
AFX_MANAGE_STATE( pThis->m_pModuleState )
In this expression, m_pModuleState is assumed to be a member variable of the containing object. It is implemented by the CCmdTarget base class and is initialized to the appropriate value by COleObjectFactory, when the object is instantiated.