다음을 통해 공유


AfxDoForAllClasses

Calls the specified iteration function for all serializable CObject-derived classes in the application's memory space.

void AFXAPI AfxDoForAllClasses( 
   void (*pfn 
)(const CRuntimeClass* pClass, 
   void* pContext 
), 
   void* pContext  
);

매개 변수

  • pfn
    Points to an iteration function to be called for each class. The function arguments are a pointer to a CRuntimeClass object and a void pointer to extra data that the caller supplies to the function.

  • pContext
    Points to optional data that the caller can supply to the iteration function. This pointer can be NULL.

설명

Serializable CObject-derived classes are classes derived using the DECLARE_SERIAL macro. The pointer that is passed to AfxDoForAllClasses in pContext is passed to the specified iteration function each time it is called.

참고

This function works only in the Debug version of MFC.

예제

#ifdef _DEBUG
void DoForAllClasses(const CRuntimeClass* pClass, void* pContext)
{
   ASSERT(pContext != NULL);
   CString *pStr = (CString *)pContext;

   *pStr += pClass->m_lpszClassName;
   *pStr += _T("\n");
}
#endif
#ifdef _DEBUG
   CString cStr;
   AfxDoForAllClasses(DoForAllClasses, &cStr);
   AfxMessageBox(cStr);
#endif

요구 사항

Header: afx.h

참고 항목

참조

DECLARE_SERIAL

개념

MFC 매크로 및 전역