다음을 통해 공유


CException::ReportError

이 멤버 함수를 보고서의 오류 텍스트 메시지 상자가 사용자에 게 호출 합니다.

virtual int ReportError(
   UINT nType = MB_OK,
   UINT nMessageID = 0 
);

매개 변수

  • nType
    메시지 상자의 스타일을 지정합니다.조합 적용 된 메시지 상자 스타일 상자.이 매개 변수를 지정 하지 않으면 기본값인 MB_OK.

  • nMessageID
    예외 개체에서 오류 메시지가 없는 경우에 표시할 메시지의 리소스 ID (문자열 테이블 항목)를 지정 합니다.0 인 경우 메시지 "오류 메시지 없음 사용할 수" 표시 됩니다.

반환 값

An AfxMessageBox value; 그렇지 않으면 메시지 상자를 표시 하려면 충분 한 메모리가 없는 경우 0입니다.참조 AfxMessageBox 가능한 반환 값에 대 한.

예제

예를 들어 사용 하는 CException::ReportError.예를 들어 다른 예제를 보려면 CATCH.

CFile fileInput;
CFileException ex;

// try to open a file for reading.  
// The file will certainly not
// exist because there are too many explicit
// directories in the name.

// if the call to Open() fails, ex will be
// initialized with exception
// information.  the call to ex.ReportError() will
// display an appropriate
// error message to the user, such as
// "\Too\Many\Bad\Dirs.DAT contains an
// invalid path."  The error message text will be
// appropriate for the
// file name and error condition.

if (!fileInput.Open(_T("\\Too\\Many\\Bad\\Dirs.DAT"), CFile::modeRead, &ex))
{
   ex.ReportError();
}
else
{
   // the file was opened, so do whatever work
   // with fileInput we were planning...

   fileInput.Close();
}

요구 사항

헤더: afx.h

참고 항목

참조

CException 클래스

계층 구조 차트

AfxMessageBox

CFileException::GetErrorMessage