开发者

Does COleException::GetErrorMessage always return the error text in English?

What would happen if the user's computer has a non-English , for example French? Would the text be in French then? I'm asking this because this is the behaviour of FormatMessage, unless the dwLanguageId parameter is specified t开发者_开发百科o LANG_ENGLISH instead of LANG_NEUTRAL.


It depends which specific exception class is in use. There is nothing in the base CException class that sets or formats the error message. However, some of the CException-derived classes do call FormatMessage when returning their error messages. For example, COleException::GetErrorMessage calls

FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM,
              NULL, m_sc,
              MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT),
              (LPTSTR) &lpBuffer, 0, NULL)

against the SCODE provided in AfxThrowOleException (note LANG_NEUTRAL).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜