Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

Move Window Under Mouse to Next Monitor With Mouse Cursor

Description
This script will move the window under the mouse, and the mouse cursor to the next monitor.
Language
C#.net
Minimum Version
Created By
Keith Lammers (BFS)
Contributors
-
Date Created
Feb 26, 2019
Date Last Modified
Feb 26, 2019

Scripted Function (Macro) Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
	public static void Run(IntPtr windowHandle)
	{
		// Get the window under the mouse
		IntPtr window = BFS.Window.GetWindowUnderMouse();
		
		// Move it to the next monitor
		BFS.Window.MoveToNextMonitor(window);
		
		// Get the new size/location for the window
		Rectangle windowBounds = BFS.Window.GetBounds(window);
		
		// Centre the mouse cursor over the window
		BFS.Input.SetMousePosition(windowBounds.X + (windowBounds.Width / 2), windowBounds.Y + (windowBounds.Height / 2));
	}
}