Пример #1
0
        public static ICollection <IntPtr> EnumMonitors(IntPtr?hdc = null, Rect?clip = null)
        {
            var list = new LinkedList <IntPtr>();

            using (var clipPtr = clip?.AllocUnmanaged(false) ?? new Disposable <IntPtr> .NoOp(IntPtr.Zero))
            {
                EnumDisplayMonitors(hdc ?? IntPtr.Zero, clipPtr.Value, (IntPtr hMonitor, IntPtr hDc, ref Rect rect, int p) =>
                {
                    list.AddLast(hMonitor);
                    return(true);
                }, 0);
            }
            return(list);
        }