Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Move All Windows To Previous Monitor

Description
This function moves all visible windows to the previous 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
Thomas Malloch (BFS)
Contributors
-
Date Created
Mar 25, 2015
Date Last Modified
Mar 25, 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.MoveToPreviousMonitor(handles[i]);
	}
}