Partager via


_com_raise_error

Microsoft Specific

Throws a _com_error in response to a failure.

void __stdcall _com_raise_error(
   HRESULT hr,
   IErrorInfo* perrinfo = 0
);

Parameters

  • hr
    HRESULT information.

  • perrinfo
    IErrorInfo object.

Remarks

_com_raise_error, which is defined in comdef.h, can be replaced by a user-written version of the same name and prototype. This could be done if you want to use #import but do not want to use C++ exception handling. In that case, a user version of _com_raise_error might decide to do a longjmp or display a message box and halt. The user version should not return, though, because the compiler COM support code does not expect it to return.

By default, _com_raise_error is defined as follows:

void __stdcall _com_raise_error(HRESULT hr, IErrorInfo* perrinfo) {
   throw _com_error(hr, perrinfo);
}

Requirements

Header: comdef.h

Lib: comsuppw.lib or comsuppwd.lib (see /Zc:wchar_t (wchar_t Is Native Type) for more information)

See Also

Concepts

Compiler COM Global Functions