1

I am developing a taskbar for the seconds screen and can't get this thing to work..

When I minimize an application on the seconds screen it will show the minimize animation to the main screen (vista & 7 aero). What I am trying to do is show the animation to my own taskbar on the seconds screen. I know it is possible because Displayfusion and Acual Multi Monitor also have this feature. So after a bit of research I discovered that you can set the minimize position with the SetWindowPlacement API. However, I can't get this to work. The window will still show the minimize animation the the main screen.

This is what I have tried so far: First hide the taskbarbutton of the window that is on the second screen with ITaskbarList DeleteTab method. Then I use this function to set the minimize position and minimize the window:

public void ShowHideAnimated(IntPtr Handle, Boolean show)
        {           
            WINDOWPLACEMENT wp = new WINDOWPLACEMENT(); 
            GetWindowPlacement(Handle, out wp);

            wp.length = Marshal.SizeOf(typeof(WINDOWPLACEMENT));

            wp.flags = WPF_SETMINPOSITION;
            wp.ptMinPosition.X = -500; //(-500,200) is a point on the second screen
            wp.ptMinPosition.Y = 200;

            if (!SetWindowPlacement(Handle, ref wp))
            {
                Debug.WriteLine( Marshal.GetLastWin32Error() );
            }

            if(!show)
            {            
                ShowWindowAsync(Handle, SW_MINIMIZE);
            }
            else
            {
                ShowWindowAsync(Handle, SW_RESTORE);
            }                 
        }
Jelle Vergeer
  • 1,018
  • 1
  • 17
  • 35
  • The last post in this topic solved my problem: http://stackoverflow.com/questions/4998833/win32-c-api-for-redirecting-minimize-animation – Jelle Vergeer Sep 07 '11 at 12:46

0 Answers0