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) { //change these variables to make this script work with your environment //note: the @ in front of the string literal will allow you to use the \ character without having to escape it string applicationPath = @"[your application path]"; uint monitorId = 3; foreach(IntPtr window in BFS.Window.GetAllWindowHandles()) { //ignore any DisplayFusion windows if(BFS.Window.GetClass(window).StartsWith("DF", StringComparison.OrdinalIgnoreCase)) continue; //if this window doesn't belong to the specified application, ignore it if(!BFS.Application.GetMainFileByWindow(window).Equals(applicationPath, StringComparison.OrdinalIgnoreCase)) continue; //move the window to the specified monitor BFS.Window.MoveToMonitor(monitorId, window); } } }