网站首页  计算机词典

请输入您要查询的字词:

 

字词 CException::ReportError
释义 CException::ReportError

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

返回值:
一个AfxMessage值。如果没有足够的内存来显示消息框,则返回0。请参阅AfxMessageBox,了解可能的返回值。

参数:
nType指定消息框的风格。把消息框风格应用在框上。如果不指定此参数,缺省为MB_OK。
nMessageID如果异常对象没有错误消息,指定要显示的消息资源的ID(字符串表入口)。如果为0,显示“没有可用的错误消息”。

说明:
调用此成员函数在消息框中向用户报告出错文本。

示例:
以下是一个使用此函数的例子:
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("\\\\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();
}

请参阅:AfxMessageBox, CException::GetErrorMessage
随便看

 

计算机英汉双解词典包含34412条计算机术语英汉翻译词条,基本涵盖了全部常用计算机术语的翻译及用法,是计算机学习及翻译工作的有利工具。

 

Copyright © 2021-2025 foosec.com All Rights Reserved
更新时间:2026/10/23 22:43:34