Exemplo n.º 1
0
 public static void SetAutoHide(bool enable)
 {
     var data = new APPBARDATA();
     data.cbSize = (uint)Marshal.SizeOf(typeof(APPBARDATA));
     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();
 }
Exemplo n.º 2
0
 public static ABS GetState()
 {
     var data = new APPBARDATA();
     data.cbSize = (uint)Marshal.SizeOf(typeof(APPBARDATA));
     data.hWnd = ShellHandle;
     var result = SHAppBarMessage((int)ABM.ABM_GETSTATE, ref data);
     return (ABS)result.ToInt32();
 }
Exemplo n.º 3
0
 public static Rectangle GetBounds()
 {
     var data = new APPBARDATA();
     data.hWnd = ShellHandle;
     // Get position and bounds.
     data.cbSize = (uint)Marshal.SizeOf(typeof(APPBARDATA));
     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);
 }
Exemplo n.º 4
0
 public static ABE GetPosition()
 {
     var data = new APPBARDATA();
     data.hWnd = ShellHandle;
     data.cbSize = (uint)Marshal.SizeOf(typeof(APPBARDATA));
     var result = SHAppBarMessage((int)ABM.ABM_GETTASKBARPOS, ref data);
     if (result == IntPtr.Zero) throw new InvalidOperationException();
     return (ABE)data.uEdge;
 }
Exemplo n.º 5
0
 public static extern IntPtr SHAppBarMessage(int dwMessage, [MarshalAs(UnmanagedType.Struct)] ref APPBARDATA pData);