Class HResult
Provides helpers around the Windows HRESULT type, when doing COM interoperation.
public static class HResult
- Inheritance
-
HResult
- Inherited Members
Fields
DISP_E_BADVARTYPE
Bad variable type.
public const int DISP_E_BADVARTYPE = -2147352568
Field Value
DISP_E_OVERFLOW
Out of present range.
public const int DISP_E_OVERFLOW = -2147352566
Field Value
DISP_E_TYPEMISMATCH
Type mismatch.
public const int DISP_E_TYPEMISMATCH = -2147352571
Field Value
E_ABORT
Operation aborted
public const int E_ABORT = -2147467260
Field Value
E_ACCESSDENIED
General access denied error
public const int E_ACCESSDENIED = -2147024891
Field Value
E_APPLICATION_EXITING
The application is exiting and cannot service this request
public const int E_APPLICATION_EXITING = -2147483622
Field Value
E_APPLICATION_VIEW_EXITING
The application view is exiting and cannot service this request
public const int E_APPLICATION_VIEW_EXITING = -2147483621
Field Value
E_BOUNDS
The operation attempted to access data outside the valid range
public const int E_BOUNDS = -2147483637
Field Value
E_CHANGEDSTATE
A concurrent or interleaved operation changed the state of the object, invalidating this operation.
public const int E_CHANGEDSTATE = -2147483636
Field Value
E_FAIL
Unspecified error
public const int E_FAIL = -2147467259
Field Value
E_HANDLE
Invalid handle
public const int E_HANDLE = -2147024890
Field Value
E_ILLEGAL_DELEGATE_ASSIGNMENT
A delegate was assigned when not allowed.
public const int E_ILLEGAL_DELEGATE_ASSIGNMENT = -2147483624
Field Value
E_ILLEGAL_METHOD_CALL
A method was called at an unexpected time.
public const int E_ILLEGAL_METHOD_CALL = -2147483634
Field Value
E_ILLEGAL_STATE_CHANGE
An illegal state change was requested.
public const int E_ILLEGAL_STATE_CHANGE = -2147483635
Field Value
E_INVALIDARG
One or more arguments are invalid
public const int E_INVALIDARG = -2147024809
Field Value
E_NOINTERFACE
No such interface supported
public const int E_NOINTERFACE = -2147467262
Field Value
E_NOTIMPL
Not implemented
public const int E_NOTIMPL = -2147467263
Field Value
E_OUTOFMEMORY
Ran out of memory
public const int E_OUTOFMEMORY = -2147024882
Field Value
E_PENDING
The data necessary to complete this operation is not yet available.
public const int E_PENDING = -2147483638
Field Value
E_POINTER
Invalid pointer
public const int E_POINTER = -2147467261
Field Value
E_STRING_NOT_NULL_TERMINATED
String not null terminated.
public const int E_STRING_NOT_NULL_TERMINATED = -2147483625
Field Value
E_UNEXPECTED
Catastrophic failure
public const int E_UNEXPECTED = -2147418113
Field Value
RO_E_MUST_BE_AGILE
The object must support the IAgileObject interface
public const int RO_E_MUST_BE_AGILE = -2147483620
Field Value
RO_E_UNSUPPORTED_FROM_MTA
Activating a single-threaded class from MTA is not supported
public const int RO_E_UNSUPPORTED_FROM_MTA = -2147483619
Field Value
STG_E_ACCESSDENIED
Access Denied.
public const int STG_E_ACCESSDENIED = -2147287035
Field Value
STG_E_DISKISWRITEPROTECTED
Disk is write-protected.
public const int STG_E_DISKISWRITEPROTECTED = -2147287021
Field Value
STG_E_FILENOTFOUND
%1 could not be found.
public const int STG_E_FILENOTFOUND = -2147287038
Field Value
STG_E_INSUFFICIENTMEMORY
There is insufficient memory available to complete operation.
public const int STG_E_INSUFFICIENTMEMORY = -2147287032
Field Value
STG_E_INVALIDFLAG
Invalid flag error.
public const int STG_E_INVALIDFLAG = -2147286785
Field Value
STG_E_INVALIDFUNCTION
Unable to perform requested operation.
public const int STG_E_INVALIDFUNCTION = -2147287039
Field Value
STG_E_INVALIDHANDLE
Attempted an operation on an invalid object.
public const int STG_E_INVALIDHANDLE = -2147287034
Field Value
STG_E_INVALIDPARAMETER
Invalid parameter error.
public const int STG_E_INVALIDPARAMETER = -2147286953
Field Value
STG_E_INVALIDPOINTER
Invalid pointer error.
public const int STG_E_INVALIDPOINTER = -2147287031
Field Value
STG_E_MEDIUMFULL
There is insufficient disk space to complete operation.
public const int STG_E_MEDIUMFULL = -2147286928
Field Value
STG_E_NOMOREFILES
There are no more entries to return.
public const int STG_E_NOMOREFILES = -2147287022
Field Value
STG_E_PATHNOTFOUND
The path %1 could not be found.
public const int STG_E_PATHNOTFOUND = -2147287037
Field Value
STG_E_READFAULT
A disk error occurred during a read operation.
public const int STG_E_READFAULT = -2147287010
Field Value
STG_E_SEEKERROR
An error occurred during a seek operation.
public const int STG_E_SEEKERROR = -2147287015
Field Value
STG_E_SHAREVIOLATION
A share violation has occurred.
public const int STG_E_SHAREVIOLATION = -2147287008
Field Value
STG_E_TOOMANYOPENFILES
There are insufficient resources to open another file.
public const int STG_E_TOOMANYOPENFILES = -2147287036
Field Value
STG_E_UNIMPLEMENTEDFUNCTION
That function is not implemented.
public const int STG_E_UNIMPLEMENTEDFUNCTION = -2147286786
Field Value
STG_E_UNKNOWN
An unexpected error occurred.
public const int STG_E_UNKNOWN = -2147286787
Field Value
STG_E_WRITEFAULT
A disk error occurred during a write operation.
public const int STG_E_WRITEFAULT = -2147287011
Field Value
S_FALSE
The call succeeded, but returned false.
public const int S_FALSE = 1
Field Value
S_OK
Success.
public const int S_OK = 0
Field Value
Methods
GetHResult(COMException)
Helper to deal with the fact that in Win Store apps, the HResult property name has changed
public static int GetHResult(this COMException exception)
Parameters
exceptionCOMExceptionCOM Exception
Returns
- int
The HResult
IsError(int)
Provides a value whether the specified HRESULT is actually an error code.
This corresponds to the IS_ERROR(x) macro.
public static bool IsError(int hResult)
Parameters
hResultintThe
HRESULTcode to test against.
Returns
MAKE_HRESULT(int, int, int)
MAKE_HRESULT macro
[Obsolete("Use MakeHResult instead.", false)]
public static int MAKE_HRESULT(int sev, int fac, int code)
Parameters
Returns
MakeHResult(int, int, int)
Constructs a new HRESULT value from the specified severity, facility and error codes.
public static int MakeHResult(int severity, int facility, int code)
Parameters
severityintThe severity that the returned
HRESULTvalue will have.facilityintThe facility that the returned
HRESULTvalue will have.codeintThe actual error code that the returned
HRESULTvalue will have.
Returns
- int
A newly constructed
HRESULTvalue.