Processing Ajax...

Title

Message

Confirm

Confirm

Confirm

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure you want to delete this item?

Confirm

Are you sure?
Save up to 50% on our desktop apps during our Year End Sale!Save up to 50% on our desktop apps during our Year End Sale, including DisplayFusion, ClipboardFusion, FileSeek, LogFusion, TrayStatus, and VoiceBot!Save up to 50% on our desktop apps during our Year End Sale!

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));
	}
}