|
1 | 1 | --- |
2 | 2 | description: "Learn more about: _com_error Class" |
3 | 3 | title: "_com_error Class" |
4 | | -ms.date: "11/04/2016" |
| 4 | +ms.date: 11/17/2022 |
5 | 5 | f1_keywords: ["_com_error"] |
6 | 6 | helpviewer_keywords: ["_com_error class"] |
7 | 7 | ms.assetid: 70dafa69-b1fb-4a5c-9249-e857e0793d42 |
8 | 8 | --- |
9 | | -# _com_error Class |
| 9 | +# `_com_error` class |
10 | 10 |
|
11 | 11 | **Microsoft Specific** |
12 | 12 |
|
13 | | -A **_com_error** object represents an exception condition detected by the error-handling wrapper functions in the header files generated from the type library or by one of the COM support classes. The **_com_error** class encapsulates the HRESULT error code and any associated `IErrorInfo Interface` object. |
| 13 | +A `_com_error` object represents an exception condition detected by the error-handling wrapper functions in the header files generated from the type library or by one of the COM support classes. The `_com_error` class encapsulates the `HRESULT` error code and any associated `IErrorInfo Interface` object. |
14 | 14 |
|
15 | 15 | ### Construction |
16 | 16 |
|
17 | 17 | | Name | Description | |
18 | | -|-|-| |
19 | | -|[_com_error](../cpp/com-error-com-error.md)|Constructs a **_com_error** object.| |
| 18 | +|---|---| |
| 19 | +| [`_com_error`](../cpp/com-error-com-error.md) | Constructs a `_com_error` object. | |
20 | 20 |
|
21 | 21 | ### Operators |
22 | 22 |
|
23 | 23 | | Name | Description | |
24 | | -|-|-| |
25 | | -|[operator =](../cpp/com-error-operator-equal.md)|Assigns an existing **_com_error** object to another.| |
| 24 | +|---|---| |
| 25 | +| [`operator =`](../cpp/com-error-operator-equal.md) | Assigns an existing `_com_error` object to another. | |
26 | 26 |
|
27 | | -### Extractor Functions |
| 27 | +### Extractor functions |
28 | 28 |
|
29 | 29 | | Name | Description | |
30 | | -|-|-| |
31 | | -|[Error](../cpp/com-error-error.md)|Retrieves the HRESULT passed to the constructor.| |
32 | | -|[ErrorInfo](../cpp/com-error-errorinfo.md)|Retrieves the `IErrorInfo` object passed to the constructor.| |
33 | | -|[WCode](../cpp/com-error-wcode.md)|Retrieves the 16-bit error code mapped into the encapsulated HRESULT.| |
| 30 | +|---|---| |
| 31 | +| [`Error`](../cpp/com-error-error.md) | Retrieves the `HRESULT` passed to the constructor. | |
| 32 | +| [`ErrorInfo`](../cpp/com-error-errorinfo.md) | Retrieves the `IErrorInfo` object passed to the constructor. | |
| 33 | +| [`WCode`](../cpp/com-error-wcode.md) | Retrieves the 16-bit error code mapped into the encapsulated `HRESULT`. | |
34 | 34 |
|
35 | | -### IErrorInfo Functions |
| 35 | +### `IErrorInfo` functions |
36 | 36 |
|
37 | 37 | | Name | Description | |
38 | | -|-|-| |
39 | | -|[Description](../cpp/com-error-description.md)|Calls `IErrorInfo::GetDescription` function.| |
40 | | -|[HelpContext](../cpp/com-error-helpcontext.md)|Calls `IErrorInfo::GetHelpContext` function.| |
41 | | -|[HelpFile](../cpp/com-error-helpfile.md)|Calls `IErrorInfo::GetHelpFile` function| |
42 | | -|[Source](../cpp/com-error-source.md)|Calls `IErrorInfo::GetSource` function.| |
43 | | -|[GUID](../cpp/com-error-guid.md)|Calls `IErrorInfo::GetGUID` function.| |
| 38 | +|---|---| |
| 39 | +| [`Description`](../cpp/com-error-description.md) | Calls `IErrorInfo::GetDescription` function. | |
| 40 | +| [`HelpContext`](../cpp/com-error-helpcontext.md) | Calls `IErrorInfo::GetHelpContext` function. | |
| 41 | +| [`HelpFile`](../cpp/com-error-helpfile.md) | Calls `IErrorInfo::GetHelpFile` function | |
| 42 | +| [`Source`](../cpp/com-error-source.md) | Calls `IErrorInfo::GetSource` function. | |
| 43 | +| [`GUID`](../cpp/com-error-guid.md) | Calls `IErrorInfo::GetGUID` function. | |
44 | 44 |
|
45 | | -### Format Message Extractor |
| 45 | +### Format message extractor |
46 | 46 |
|
47 | 47 | | Name | Description | |
48 | | -|-|-| |
49 | | -|[ErrorMessage](../cpp/com-error-errormessage.md)|Retrieves the string message for HRESULT stored in the **_com_error** object.| |
| 48 | +|---|---| |
| 49 | +| [`ErrorMessage`](../cpp/com-error-errormessage.md) | Retrieves the string message for `HRESULT` stored in the `_com_error` object. | |
50 | 50 |
|
51 | | -### ExepInfo.wCode to HRESULT Mappers |
| 51 | +### `ExepInfo.wCode` to `HRESULT` mappers |
52 | 52 |
|
53 | 53 | | Name | Description | |
54 | | -|-|-| |
55 | | -|[HRESULTToWCode](../cpp/com-error-hresulttowcode.md)|Maps 32-bit HRESULT to 16-bit `wCode`.| |
56 | | -|[WCodeToHRESULT](../cpp/com-error-wcodetohresult.md)|Maps 16-bit `wCode` to 32-bit HRESULT.| |
| 54 | +|---|---| |
| 55 | +| [`HRESULTToWCode`](../cpp/com-error-hresulttowcode.md) | Maps 32-bit `HRESULT` to 16-bit `wCode`. | |
| 56 | +| [`WCodeToHRESULT`](../cpp/com-error-wcodetohresult.md) | Maps 16-bit `wCode` to 32-bit `HRESULT`. | |
57 | 57 |
|
58 | 58 | **END Microsoft Specific** |
59 | 59 |
|
60 | 60 | ## Requirements |
61 | 61 |
|
62 | 62 | **Header:** \<comdef.h> |
63 | 63 |
|
64 | | -`Lib:` comsuppw.lib or comsuppwd.lib (see [/Zc:wchar_t (wchar_t Is Native Type)](../build/reference/zc-wchar-t-wchar-t-is-native-type.md) for more information) |
| 64 | +**Library:** *`comsuppw.lib`* or *`comsuppwd.lib`* (for more information, see [`/Zc:wchar_t` (wchar_t is native type)](../build/reference/zc-wchar-t-wchar-t-is-native-type.md)) |
65 | 65 |
|
66 | 66 | ## See also |
67 | 67 |
|
68 | | -[Compiler COM Support Classes](../cpp/compiler-com-support-classes.md)<br/> |
69 | | -[IErrorInfo Interface](/windows/win32/api/oaidl/nn-oaidl-ierrorinfo) |
| 68 | +[Compiler COM support classes](../cpp/compiler-com-support-classes.md)\ |
| 69 | +[`IErrorInfo` interface](/windows/win32/api/oaidl/nn-oaidl-ierrorinfo) |
0 commit comments