Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Move to Next Monitor or Show Monitor Selector

Description
This function will move the window to the next monitor if there are only 2 monitors present. If there are more than 2, it will show the monitor selector popup.
Language
C#.net
Minimum Version
Created By
Keith Lammers (BFS)
Contributors
-
Date Created
Feb 2, 2016
Date Last Modified
Feb 2, 2016

Scripted Function (Macro) Code

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)
	{
    	// Check if there are more than two monitors
        // If there are, show the monitor selector
        // Otherwise, just move the window to the next monitor
		if (BFS.Monitor.GetMonitorIDs().Length > 2)
			{
				BFS.DisplayFusion.RunFunction("Move Window to Different Monitor (shows monitor selector)");
			}
		else
			{
				BFS.Window.MoveToNextMonitor(windowHandle);	
			}
	}		
}