1

I'm working on an application for home based users. And this application involves completely replacing windows explorer for a custom application.

I would like to mimic the behavior of the taskbar. For example, when you click the maximize button in Notepad, it does not overlap the taskbar.

I already tried to use the api to AppBar however, AppBar api does not work when windows explorer is not running and other windows overlap my taskbar.

Any idea how I can do this? If I can restrict the size of maximized windows when ever helps me. The problem is that other applications are not always written by me.

Charles A.
  • 41
  • 4
  • possible duplicate of [How do you do AppBar docking (to screen edge, like WinAmp) in WPF?](http://stackoverflow.com/questions/75785/how-do-you-do-appbar-docking-to-screen-edge-like-winamp-in-wpf) This isn't just about docking, but how to tell windows that a part of the screen is no longer available for other windows when maximized (like the start bar). – Erik Philips Aug 04 '14 at 21:37
  • The AppBar api doesn't work when windows explorer is not running. In this case, I have to completely replace windows explorer. – Charles A. Aug 05 '14 at 01:09
  • If you are voting down this question, can you tell me what am I doing wrong? – Charles A. Aug 05 '14 at 01:41
  • I didn't downvote. I understand the question completely. I think it's a reasonable question. (But I don't have an answer/comment beyond my previous link). – Erik Philips Aug 05 '14 at 15:37

1 Answers1

1

I found an example using an win32 api SystemParametersInfo. This way I can define an area where the other applications will fit and leave an space to my form even if other applications is maximized.

Link on github

public static void MakeNewDesktopArea()
    {
        // Save current Working Area size
        m_rcOldDesktopRect.left = SystemInformation.WorkingArea.Left;
        m_rcOldDesktopRect.top = SystemInformation.WorkingArea.Top;
        m_rcOldDesktopRect.right = SystemInformation.WorkingArea.Right;
        m_rcOldDesktopRect.bottom = SystemInformation.WorkingArea.Bottom;

        // Make a new Workspace
        WinAPI.RECT rc;
        rc.left = SystemInformation.VirtualScreen.Left + 150;
        rc.top = SystemInformation.VirtualScreen.Top; // We reserve the 24 pixels on top for our taskbar
        rc.right = SystemInformation.VirtualScreen.Right;
        rc.bottom = SystemInformation.VirtualScreen.Bottom - 101;
        WinAPI.SystemParametersInfo((int)WinAPI.SPI.SPI_SETWORKAREA, 0, ref rc, 0);
    }
Charles A.
  • 41
  • 4