Nóta
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað aðskrá þig inn eða breyta skráasöfnum.
Aðgangur að þessari síðu krefst heimildar. Þú getur prófað að breyta skráasöfnum.
Microsoft Specific
Constructs a _com_error object.
Syntax
_com_error(
HRESULT hr,
IErrorInfo* perrinfo = NULL,
bool fAddRef = false) throw();
_com_error( const _com_error& that ) throw();
Parameters
hr
HRESULT information.
perrinfo
IErrorInfo object.
fAddRef
The default causes the constructor to not call AddRef on a non-null IErrorInfo interface. This behavior provides for correct reference counting in the common case where ownership of the interface is passed into the _com_error object, such as:
throw _com_error(hr, perrinfo);
If you don't want your code to transfer ownership to the _com_error object, and the AddRef is required to offset the Release in the _com_error destructor, construct the object as follows:
_com_error err(hr, perrinfo, true);
that
An existing _com_error object.
Remarks
The first constructor creates a new object given an HRESULT and optional IErrorInfo object. The second creates a copy of an existing _com_error object.
END Microsoft Specific