Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

Move All Windows To Next Monitor

Description
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.
Language
C#.net
Minimum Version
Created By
Oliver Haskell569549
Contributors
-
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++)
			BFS.Window.MoveToNextMonitor(handles[i]);
	}
}