Beispiel #1
0
        public static void AdjustForAutoHideTaskbar(IntPtr hAppMonitor, ref RECT workspace)
        {
            // NOTE: for xp the adjustment for autohidden taskbar makes maximized window movable
            // but I don't know the way to fix it.
            IntPtr htaskbar = User32.FindWindow("Shell_TrayWnd", null);
            if (htaskbar != IntPtr.Zero)
            {
                IntPtr monitorWithTaskbarOnIt = User32.MonitorFromWindow(htaskbar, MonitorOption.MONITOR_DEFAULTTONEAREST);
                if (hAppMonitor.Equals(monitorWithTaskbarOnIt))
                {
                    APPBARDATA abd = new APPBARDATA();
                    abd.cbSize = (uint)Marshal.SizeOf(abd);
                    abd.hWnd = htaskbar;
                    bool autoHide = (Shell32.SHAppBarMessage(AppBarMessage.ABM_GETSTATE, ref abd).ToUInt32() & ABS_AUTOHIDE) == ABS_AUTOHIDE;

                    if (autoHide)
                    {
                        Shell32.SHAppBarMessage(AppBarMessage.ABM_GETTASKBARPOS, ref abd);
                        var uEdge = GetEdge(ref abd.rc);

                        switch (uEdge)
                        {
                            case AppBarEdge.ABE_LEFT:
                                workspace.left += 2;
                                break;
                            case AppBarEdge.ABE_RIGHT:
                                workspace.right -= 2;
                                break;
                            case AppBarEdge.ABE_TOP:
                                workspace.top += 2;
                                break;
                            case AppBarEdge.ABE_BOTTOM:
                                workspace.bottom -= 2;
                                break;
                        }
                    }
                }
            }
        }
Beispiel #2
0
 public static extern UIntPtr SHAppBarMessage(AppBarMessage dwMessage, ref APPBARDATA pData);
Beispiel #3
0
 /// <summary>
 /// Sends an appbar message to the system.
 /// </summary>
 /// <param name="dwMessage">Appbar message value to send.</param>
 /// <param name="pData">A pointer to an APPBARDATA structure. The content of the structure on entry and on exit depends on the value set in the dwMessage parameter. See the individual message pages for specifics.</param>
 /// <returns></returns>
 public static UIntPtr SHAppBarMessage(AppBarMessage dwMessage, ref APPBARDATA pData)
 {
     return NativeMethods.SHAppBarMessage(dwMessage, ref pData);
 }