示例#1
0
        public Taskbar()
        {
            var taskbarHandle = User32.FindWindow(ClassName, null);

            var data = new AppBarData {
                cbSize = (uint)Marshal.SizeOf(typeof(AppBarData)), hWnd = taskbarHandle
            };
            var result = Shell32.SHAppBarMessage(Abm.GetTaskbarPos, ref data);

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

            Position = (TaskbarPosition)data.uEdge;
            Bounds   = Rectangle.FromLTRB(data.rc.left, data.rc.top, data.rc.right, data.rc.bottom);

            data.cbSize = (uint)Marshal.SizeOf(typeof(AppBarData));
            result      = Shell32.SHAppBarMessage(Abm.GetState, ref data);
            var state = result.ToInt32();

            AlwaysOnTop = (state & Abs.AlwaysOnTop) == Abs.AlwaysOnTop;
            AutoHide    = (state & Abs.Autohide) == Abs.Autohide;
        }
示例#2
0
 public static extern IntPtr SHAppBarMessage(Abm dwMessage, [In] ref AppBarData pData);