コード例 #1
0
        public static DWM_TIMING_INFO?DwmGetCompositionTimingInfo(IntPtr hwnd)
        {
            if (!Utility.IsOSVistaOrNewer)
            {
                return(null);
            }
            DWM_TIMING_INFO value = new DWM_TIMING_INFO
            {
                cbSize = Marshal.SizeOf(typeof(DWM_TIMING_INFO))
            };
            HRESULT hrLeft = NativeMethods._DwmGetCompositionTimingInfo(hwnd, ref value);

            if (hrLeft == HRESULT.E_PENDING)
            {
                return(null);
            }
            hrLeft.ThrowIfFailed();
            return(new DWM_TIMING_INFO?(value));
        }
コード例 #2
0
        public static DWM_TIMING_INFO?DwmGetCompositionTimingInfo(IntPtr hwnd)
        {
            DWM_TIMING_INFO?nullable;

            if (!Utility.IsOSVistaOrNewer)
            {
                nullable = null;
                return(nullable);
            }
            DWM_TIMING_INFO dWMTIMINGINFO = new DWM_TIMING_INFO()
            {
                cbSize = Marshal.SizeOf(typeof(DWM_TIMING_INFO))
            };
            DWM_TIMING_INFO dWMTIMINGINFO1 = dWMTIMINGINFO;
            HRESULT         hRESULT        = Standard.NativeMethods.DwmGetCompositionTimingInfo_1(hwnd, ref dWMTIMINGINFO1);

            if (hRESULT == HRESULT.E_PENDING)
            {
                nullable = null;
                return(nullable);
            }
            hRESULT.ThrowIfFailed();
            return(new DWM_TIMING_INFO?(dWMTIMINGINFO1));
        }
コード例 #3
0
ファイル: NativeMethods.cs プロジェクト: JianwenSun/cc
        public static DWM_TIMING_INFO? DwmGetCompositionTimingInfo(IntPtr hwnd)
        {
            if (!Utility.IsOSVistaOrNewer)
            {
                // API was new to Vista.
                return null;
            }

            var dti = new DWM_TIMING_INFO { cbSize = Marshal.SizeOf(typeof(DWM_TIMING_INFO)) };
            HRESULT hr = _DwmGetCompositionTimingInfo(hwnd, ref dti);
            if (hr == HRESULT.E_PENDING)
            {
                // The system isn't yet ready to respond.  Return null rather than throw.
                return null;
            }
            hr.ThrowIfFailed();

            return dti;
        }
コード例 #4
0
ファイル: NativeMethods.cs プロジェクト: JianwenSun/cc
 private static extern HRESULT _DwmGetCompositionTimingInfo(IntPtr hwnd, ref DWM_TIMING_INFO pTimingInfo);
コード例 #5
0
 private static extern HRESULT _DwmGetCompositionTimingInfo(IntPtr hwnd, ref DWM_TIMING_INFO pTimingInfo);