Example #1
0
        public static ABS GetState()
        {
            var data = new APPBARDATA();

            data.Initialize();
            data.hWnd = ShellHandle;
            var result = SHAppBarMessage((int)ABM.ABM_GETSTATE, ref data);

            return((ABS)result.ToInt32());
        }
Example #2
0
        public static ABE GetPosition()
        {
            var data = new APPBARDATA();

            data.Initialize();
            data.hWnd = ShellHandle;
            var result = SHAppBarMessage((int)ABM.ABM_GETTASKBARPOS, ref data);

            if (result == IntPtr.Zero)
            {
                throw new InvalidOperationException();
            }
            return(data.uEdge);
        }
Example #3
0
        public static Rectangle GetBounds()
        {
            var data = new APPBARDATA();

            data.Initialize();
            data.hWnd = ShellHandle;
            // Get position and bounds.
            var result = SHAppBarMessage((int)ABM.ABM_GETTASKBARPOS, ref data);

            if (result == IntPtr.Zero)
            {
                throw new InvalidOperationException();
            }
            return(Rectangle.FromLTRB(data.rc.left, data.rc.top, data.rc.right, data.rc.bottom));
        }
Example #4
0
        public static void SetAutoHide(bool enable)
        {
            var data = new APPBARDATA();

            data.Initialize();
            data.hWnd   = ShellHandle;
            data.lParam = (int)ABS.ABS_ALWAYSONTOP;
            if (enable)
            {
                data.lParam |= (int)ABS.ABS_AUTOHIDE;
            }
            var result = SHAppBarMessage((int)ABM.ABM_SETSTATE, ref data);

            if (result == IntPtr.Zero)
            {
                throw new InvalidOperationException();
            }
        }