using System;
using System.Diagnostics;
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
string chromePath = @"C:\Program Files\Google\Chrome\Application\chrome.exe";
IntPtr myWorkWindow = BFS.Window.GetFocusedWindow();
// 1. WINDOW: Monitor 1 (Primary)
Process.Start(chromePath, "--new-window");
IntPtr win1 = WaitForNewWindow(myWorkWindow);
if (win1 != IntPtr.Zero)
{
BFS.Window.MoveToMonitor(1, win1);
BFS.Window.Maximize(win1);
BFS.Window.Focus(win1);
}
// Delay to allow Chrome to stabilize
BFS.General.ThreadWait(2000);
// 2. WINDOW: Monitor 2 (Secondary / Ultra-Wide)
Process.Start(chromePath, "--new-window");
// We ignore win1 to ensure we capture the second new window
IntPtr win2 = WaitForNewWindow(win1);
if (win2 != IntPtr.Zero && win2 != win1)
{
BFS.Window.MoveToMonitor(2, win2);
BFS.Window.Restore(win2);
// Set your preferred size here (Width, Height)
BFS.Window.SetSize(win2, 2560, 1300);
BFS.Window.SetLocation(win2, 0, 0);
BFS.Window.Focus(win2);
}
}
private static IntPtr WaitForNewWindow(IntPtr ignore)
{
for (int i = 0; i < 20; i++)
{
BFS.General.ThreadWait(400);
IntPtr current = BFS.Window.GetFocusedWindow();
if (current != IntPtr.Zero && current != ignore)
{
if (BFS.Window.GetText(current).Length > 0)
{
return current;
}
}
}
return IntPtr.Zero;
}
}