com 예외에서 HRESULT 값을 얻으려고하면 경고 메시지가 표시되고 이것이 C#에서 COM 예외를 처리하는 올바른 방법이 아닌 경우 의심 스럽습니다. 코드를 조언 해주십시오. 아래처럼.경고 COM 예외 처리 C#
try
{
...
}
catch (System.Runtime.InteropServices.COMException comex)
{
// Warning 8 Comparison to integral constant is useless; the constant is outside the range of type 'int'
if (comex.ErrorCode == Constants.E_FAIL)
{
}
}
E_FAIL는
public const UInt32 E_FAIL = 0x80004005;
E_FAIL 값이 MSDN에 정의되어 있습니다. 직접 정의 할 수 없으며 그렇지만 int32를 초과 할 수도 있지만 예외로부터 HRESULT를 얻으려면 어떻게해야합니까? – Ahmed