Microsoft 特定的
建構 _com_error 物件。
語法
_com_error(
HRESULT hr,
IErrorInfo* perrinfo = NULL,
bool fAddRef = false) throw();
_com_error( const _com_error& that ) throw();
參數
hr
HRESULT 資訊。
perrinfo
IErrorInfo 物件
fAddRef
預設值會讓建構函式在非 Null IErrorInfo 介面上不呼叫 AddRef。 此行為提供正確的參考計數,在介面擁有權傳遞至 _com_error 物件時,例如:
throw _com_error(hr, perrinfo);
如果您不想讓程式代碼將擁有權傳送至 _com_error 物件,而且 AddRef 需要 位移 Release 解構函式中的 _com_error ,請建構 物件,如下所示:
_com_error err(hr, perrinfo, true);
that
現有的 _com_error 物件。
備註
第一個建構函式會建立指定 HRESULT 和 選擇性 IErrorInfo 物件的新物件。 第二個會建立現有 _com_error 對象的複本。
END Microsoft 特定的