using System;
using System.Drawing;
using System.IO;
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
// Set the monitor ID you want the File Explorer windows to open on
uint targetMonitorID = 1;
// If you want to open the File Explorer windows to specific folders, put the folder paths
// inside the quotes below otherwise just leave them blank
string[] folderPaths = { @"C:\Folder1",
@"C:\Folder2",
@"C:\Folder3",
@"C:\Folder4" };
// If the windows open but don't move correctly, try adjusting this delay
uint launchDelay = 1000;
// Window 1
IntPtr window1 = LaunchAndMoveFileExplorer(targetMonitorID, launchDelay, folderPaths[0]);
BFS.DisplayFusion.RunFunctionWithWindowHandle("Move Window to Top-Left Corner and Size 50%", window1);
// Window 2
IntPtr window2 = LaunchAndMoveFileExplorer(targetMonitorID, launchDelay, folderPaths[1]);
BFS.DisplayFusion.RunFunctionWithWindowHandle("Move Window to Top-Right Corner and Size 50%", window2);
// Window 3
IntPtr window3 = LaunchAndMoveFileExplorer(targetMonitorID, launchDelay, folderPaths[2]);
BFS.DisplayFusion.RunFunctionWithWindowHandle("Move Window to Bottom-Left Corner and Size 50%", window3);
// Window 4
IntPtr window4 = LaunchAndMoveFileExplorer(targetMonitorID, launchDelay, folderPaths[3]);
BFS.DisplayFusion.RunFunctionWithWindowHandle("Move Window to Bottom-Right Corner and Size 50%", window4);
}
private static IntPtr LaunchAndMoveFileExplorer(uint targetMonitorID, uint launchDelay, string folderPath)
{
// Check if the folder window is already open, if not, open it
string folderName = Path.GetFileName(folderPath.TrimEnd(Path.DirectorySeparatorChar));
IntPtr window = BFS.Window.GetWindowByText(folderName);
if (window == IntPtr.Zero)
{
// Open the folder window
BFS.Application.Start("C:\\Windows\\explorer.exe", folderPath.TrimEnd(Path.DirectorySeparatorChar));
BFS.General.ThreadWait(launchDelay);
// Get the window handle based on the folder name, as this is what will be in the window title
window = BFS.Window.GetWindowByText(folderName);
// Move the window to the target monitor
BFS.Window.MoveToMonitor(targetMonitorID, window);
BFS.General.ThreadWait(100);
}
// Return the window handle
return window;
}
}