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?

Move Mouse to Next Monitor and Focus the Window Under the Cursor

Description
This script will move the mouse cursor to the next monitor, then focus the window that the mouse cursor is over.
Language
C#.net
Minimum Version
Created By
Keith Lammers (BFS)
Contributors
-
Date Created
Sep 4, 2018
Date Last Modified
Sep 4, 2018

Scripted Function (Macro) Code

using System;
using System.Drawing;
using System.Windows.Forms;

public static class DisplayFusionFunction
{
    [System.Runtime.InteropServices.DllImport("user32.dll")]
    private static extern IntPtr WindowFromPoint(Point pnt);

	public static void Run(IntPtr windowHandle)
	{
        // Move the mouse cursor to the next monitor
        BFS.DisplayFusion.RunFunction("Move Mouse Cursor to Next Monitor");
        BFS.General.ThreadWait(100);

	    // Focus the window that the mouse cursor is over
        IntPtr windowUnderMouse = WindowFromPoint(Cursor.Position);
        BFS.Window.Focus(BFS.Window.GetParentRoot(windowUnderMouse));
	}
}