using System;
using System.Drawing;
using System.Windows.Forms;
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
// set the monitor IDs of the monitors you want to swap here
uint monitorA = 1;
uint monitorB = 2;
//if the passed window handle doesn't exist, exit the function
if (windowHandle == IntPtr.Zero)
return;
//get the open windows for each monitor
IntPtr[] srcWindowsMonitor2 = BFS.Window.GetVisibleWindowHandlesByMonitor(monitorB);
IntPtr[] srcWindowsMonitor1 = BFS.Window.GetVisibleWindowHandlesByMonitor(monitorA);
//move all of the windows in the destination monitor to the source monitor
foreach (IntPtr window in srcWindowsMonitor2)
{
if (BFS.Window.GetText(window).Contains("Chrome"))
{
BFS.Window.Restore(window);
BFS.Window.MoveToMonitor(monitorA, window);
BFS.Window.Maximize(window);
}
BFS.Window.MoveToMonitor(monitorA, window);
}
BFS.General.ThreadWait(1000);
//move all of the windows in the source monitor to the destination monitor
foreach (IntPtr window in srcWindowsMonitor1)
{
if (BFS.Window.GetText(window).Contains("Chrome"))
{
BFS.Window.Restore(window);
BFS.Window.MoveToMonitor(monitorB, window);
BFS.Window.Maximize(window);
}
BFS.Window.MoveToMonitor(monitorB, window);
}
}
}