예제 #1
0
 public override string ToString()
 {
     foreach (FieldInfo info in typeof(Standard.HRESULT).GetFields(BindingFlags.Public | BindingFlags.Static))
     {
         if (info.FieldType == typeof(Standard.HRESULT))
         {
             Standard.HRESULT hresult = (Standard.HRESULT)info.GetValue(null);
             if (hresult == this)
             {
                 return(info.Name);
             }
         }
     }
     if (this.Facility == Standard.Facility.Win32)
     {
         foreach (FieldInfo info2 in typeof(Standard.Win32Error).GetFields(BindingFlags.Public | BindingFlags.Static))
         {
             if (info2.FieldType == typeof(Standard.Win32Error))
             {
                 Standard.Win32Error error = (Standard.Win32Error)info2.GetValue(null);
                 if (((Standard.HRESULT)error) == this)
                 {
                     return("HRESULT_FROM_WIN32(" + info2.Name + ")");
                 }
             }
         }
     }
     return(string.Format(CultureInfo.InvariantCulture, "0x{0:X8}", new object[] { this._value }));
 }
예제 #2
0
 public static Standard.DWM_TIMING_INFO?DwmGetCompositionTimingInfo(IntPtr hwnd)
 {
     if (!Standard.Utility.IsOSVistaOrNewer)
     {
         return(null);
     }
     Standard.DWM_TIMING_INFO pTimingInfo = new Standard.DWM_TIMING_INFO {
         cbSize = Marshal.SizeOf(typeof(Standard.DWM_TIMING_INFO))
     };
     Standard.HRESULT hresult = _DwmGetCompositionTimingInfo(hwnd, ref pTimingInfo);
     if (hresult == Standard.HRESULT.E_PENDING)
     {
         return(null);
     }
     hresult.ThrowIfFailed();
     return(new Standard.DWM_TIMING_INFO?(pTimingInfo));
 }
예제 #3
0
 static HRESULT()
 {
     S_OK                              = new Standard.HRESULT(0);
     S_FALSE                           = new Standard.HRESULT(1);
     E_PENDING                         = new Standard.HRESULT(0x8000000a);
     E_NOTIMPL                         = new Standard.HRESULT(0x80004001);
     E_NOINTERFACE                     = new Standard.HRESULT(0x80004002);
     E_POINTER                         = new Standard.HRESULT(0x80004003);
     E_ABORT                           = new Standard.HRESULT(0x80004004);
     E_FAIL                            = new Standard.HRESULT(0x80004005);
     E_UNEXPECTED                      = new Standard.HRESULT(0x8000ffff);
     STG_E_INVALIDFUNCTION             = new Standard.HRESULT(0x80030001);
     REGDB_E_CLASSNOTREG               = new Standard.HRESULT(0x80040154);
     DESTS_E_NO_MATCHING_ASSOC_HANDLER = new Standard.HRESULT(0x80040f03);
     DESTS_E_NORECDOCS                 = new Standard.HRESULT(0x80040f04);
     DESTS_E_NOTALLCLEARED             = new Standard.HRESULT(0x80040f05);
     E_ACCESSDENIED                    = new Standard.HRESULT(0x80070005);
     E_OUTOFMEMORY                     = new Standard.HRESULT(0x8007000e);
     E_INVALIDARG                      = new Standard.HRESULT(0x80070057);
     INTSAFE_E_ARITHMETIC_OVERFLOW     = new Standard.HRESULT(0x80070216);
     COR_E_OBJECTDISPOSED              = new Standard.HRESULT(0x80131622);
     WC_E_GREATERTHAN                  = new Standard.HRESULT(0xc00cee23);
     WC_E_SYNTAX                       = new Standard.HRESULT(0xc00cee2d);
 }