using System;
using System.Drawing;
// The 'windowHandle' parameter will contain the window handle for the:
// - Active window when run by hotkey
// - Window Location target when run by a Window Location rule
// - TitleBar Button owner when run by a TitleBar Button
// - Jump List owner when run from a Taskbar Jump List
// - Currently focused window if none of these match
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
//get the firefox appid
uint firefox = BFS.Application.GetAppIDByFile("*firefox.exe");
//if firefox is running, kill it
if(firefox != 0)
{
BFS.Application.Kill(firefox);
BFS.Application.WaitForExitByAppID(firefox, 5000);
}
//start a new instance of firefox
firefox = BFS.Application.Start("C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe", "");
//wait up to 5s for firefox to start (50 * 100ms)
for(int i = 0; (i < 50) && (!BFS.Application.IsAppRunningByAppID(firefox)); i++)
BFS.General.Sleep(100);
//focus firefox
BFS.Window.Focus(BFS.Application.GetMainWindowByAppID(firefox));
BFS.General.Sleep(1000);
//make firefox full screen
BFS.Input.SendKeys("{F11}");
BFS.General.Sleep(3000);
//span firefox across all monitors
BFS.DisplayFusion.RunFunction("Span Window Across All Monitors");
}
}