Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

A recent AVG and Avast antivirus update is preventing DisplayFusion 9.9 from launching on some systems.
If you're running into this issue, please update to the latest DisplayFusion 10.0 Beta.

Focus the Window Under the Mouse Cursor

Description
This script will focus the window that the mouse cursor is currently under.
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)
	{        
        IntPtr windowUnderMouse = WindowFromPoint(Cursor.Position);
        BFS.Window.Focus(BFS.Window.GetParentRoot(windowUnderMouse));
	}
}