Processing Ajax...

Close Dialog


Close Dialog

Close Dialog

A recent AVG and Avast antivirus update is preventing DisplayFusion 9.9 from launching on some systems.
If you're running into this issue, please update to the latest DisplayFusion 10.0 Beta.

Move All Windows To Next Monitor

This function moves all visible windows to the next monitor. If you have 2 monitors this effectively swaps the windows on monitor 1 to monitor 2 and vice versa.
Minimum Version
Created By
Oliver Haskell569549
Date Created
Feb 10, 2015
Date Last Modified
Feb 10, 2015

Scripted Function (Macro) Code

using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;

// 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 visible window handles
		IntPtr[] handles = BFS.Window.GetVisibleWindowHandles();

		// loop through window handles and send each to the next monitor
		for (int i = 0; i < handles.Length; i++)