private void WmGetMinmaxInfo(IntPtr hwnd, IntPtr lParam) { var mmi = MarshalEx.PtrToStructure <MINMAXINFO>(lParam); IntPtr monitor = UnsafeNativeMethods.MonitorFromWindow( hwnd, (uint)Monitor.DEFAULTTONEAREST); if (monitor != IntPtr.Zero) { var mInfo = new MONITORINFO(); mInfo.cbSize = MarshalEx.SizeOf <MONITORINFO>(); UnsafeNativeMethods.GetMonitorInfo(monitor, ref mInfo); mmi.ptMaxPosition.X = Math.Abs(mInfo.rcWork.left - mInfo.rcMonitor.left); mmi.ptMaxPosition.Y = Math.Abs(mInfo.rcWork.top - mInfo.rcMonitor.top); mmi.ptMaxSize.X = Math.Abs(mInfo.rcWork.right - mInfo.rcWork.left); mmi.ptMaxSize.Y = Math.Abs(mInfo.rcWork.bottom - mInfo.rcWork.top); } mmi.ToPtr(lParam, true); }
public static ComputeBuffer Create <T>(int count) => new ComputeBuffer(count, MarshalEx.SizeOf <T>());
public static ComputeBuffer Create <T>(T[] data) => new ComputeBuffer(data.Length, MarshalEx.SizeOf <T>());