using System.Runtime.InteropServices; namespace WPFluent.Interop; /// /// Common Windows API result; /// internal struct HRESULT { /// /// Operation successful. /// public const int NO_ERROR = unchecked(0x00000000); /// /// Operation successful. /// public const int NOERROR = unchecked(0x00000000); /// /// Unspecified failure. /// public const int S_FALSE = unchecked(0x00000001); /// /// Operation successful. /// public const int S_OK = unchecked(0x00000000); public static void Check(int hr) { if(hr >= S_OK) { return; } Marshal.ThrowExceptionForHR(hr, (IntPtr)(-1)); } }