private static void InvalidateInternal()
        {
            _handle = Interop.FindWindow("Shell_TrayWnd", null);

            var data = new Interop.APPBARDATA {
                hWnd = _handle, cbSize = Marshal.SizeOf(typeof(Interop.APPBARDATA))
            };

            Interop.SHAppBarMessage(Interop.ABM_GETTASKBARPOS, ref data);

            _position = (TaskbarPosition)data.uEdge;
            _left     = data.rc.left;
            _top      = data.rc.top;
            _right    = data.rc.right;
            _bottom   = data.rc.bottom;

            data = new Interop.APPBARDATA {
                hWnd = _handle, cbSize = Marshal.SizeOf(typeof(Interop.APPBARDATA))
            };

            var state = Interop.SHAppBarMessage(Interop.ABM_GETSTATE, ref data).ToInt32();

            // See http://msdn.microsoft.com/en-us/library/bb787947(v=vs.85).aspx
            _alwaysOnTop = (state & Interop.ABS_ALWAYSONTOP) == Interop.ABS_ALWAYSONTOP || (Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 1);
            _autoHide    = (state & Interop.ABS_AUTOHIDE) == Interop.ABS_AUTOHIDE;

            _isCacheValid = true;
        }
예제 #2
0
        private static void InvalidateInternal()
        {
            _handle = Interop.FindWindow("Shell_TrayWnd", null);

            var data = new Interop.APPBARDATA { hWnd = _handle, cbSize = Marshal.SizeOf(typeof(Interop.APPBARDATA)) };
            Interop.SHAppBarMessage(Interop.ABM_GETTASKBARPOS, ref data);

            _position = (TaskbarPosition)data.uEdge;
            _left = data.rc.left;
            _top = data.rc.top;
            _right = data.rc.right;
            _bottom = data.rc.bottom;

            data = new Interop.APPBARDATA { hWnd = _handle, cbSize = Marshal.SizeOf(typeof(Interop.APPBARDATA)) };

            var state = Interop.SHAppBarMessage(Interop.ABM_GETSTATE, ref data).ToInt32();

            // See http://msdn.microsoft.com/en-us/library/bb787947(v=vs.85).aspx
            _alwaysOnTop = (state & Interop.ABS_ALWAYSONTOP) == Interop.ABS_ALWAYSONTOP || (Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 6 && Environment.OSVersion.Version.Minor >= 1);
            _autoHide = (state & Interop.ABS_AUTOHIDE) == Interop.ABS_AUTOHIDE;

            _isCacheValid = true;
        }