uint const HRESULT_ERROR = 0x80000000;
try
{
CallCom();
}
catch (COMException comEx)
{
if (comEx.ErrorCode == unchecked((int)HRESULT_ERROR))
{
DoSomething();
}
}
Edit: Okay, made an mistake with this. HRESULT is an unsigned integer, so comparing it with an integer is not a good idea. We need to cast it unchecked to an integer.
No comments:
Post a Comment