Пример #1
0
        public static SystemInterop.RECT GetWorkingArea()
        {
            IntPtr ptr = IntPtr.Zero;

            SystemInterop.RECT rect = new SystemInterop.RECT();
            SystemInterop.SystemParametersInfo(SystemInterop.SPI.SPI_GETWORKAREA, 0, ref rect, SystemInterop.SPIF.SPIF_UPDATEINIFILE);
            return(rect);
        }
Пример #2
0
        public static void SetWorkingArea(int left, int top, int right, int bottom)
        {
            IntPtr ptr = IntPtr.Zero;

            SystemInterop.RECT rect = new SystemInterop.RECT()
            {
                Left = left, Top = top, Right = right, Bottom = bottom
            };
            SystemInterop.SystemParametersInfo(SystemInterop.SPI.SPI_SETWORKAREA, 0, ref rect, SystemInterop.SPIF.SPIF_UPDATEINIFILE);
        }
Пример #3
0
        public static void SetWorkingArea(int left, int top, int right, int bottom)
        {
            IntPtr ptr = IntPtr.Zero;

            SystemInterop.RECT rect = new SystemInterop.RECT()
            {
                Left = left, Top = top, Right = right, Bottom = bottom
            };
            bool success = SystemInterop.SystemParametersInfo(SystemInterop.SPI.SPI_SETWORKAREA, 0, ref rect, SystemInterop.SPIF.SPIF_CHANGE);

            if (!success)
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }
        }