Save up to 50% off any of our desktop apps in our 2021 spring sale, including
DisplayFusion, ClipboardFusion, FileSeek, LogFusion, TrayStatus, and VoiceBot!




<< DiscussionsReply

How can I make my window-mirror scripted function re-select the source window?

3 discussion posts
I've downloaded a scripted function to mirror a source window to a specific monitor.

I use it to mirror VLC media player.

At the moment, the mirror window is "active" after the script runs, so my keyboard doesn't control VLC until re-select VLC

I would like to automatically re-select the window that was active when I ran the scripted function.


This is the script I use

using System;
using System.Drawing;

// The 'windowHandle' parameter will contain the window handle for the:
//   - Active window when run by hotkey
//   - Trigger target when run by a Trigger 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)
        // Mirror the window and move it        
        IntPtr mirrorWindow = BFS.DisplayFusion.MirrorWindowNoBorder(windowHandle);
        BFS.Window.MoveToMonitorMaximized(5, mirrorWindow);
Nov 22, 2020 (modified Nov 22, 2020)  • #1
Owen Muhlethaler (BFS)'s profile on
Hi Steve,

If you put this line below it should refocus the last
window: BFS.Window.Focus(windowHandle);

Hope that helps!
Nov 24, 2020  • #2
3 discussion posts
Works Perfect!
Thanks very much.
Nov 24, 2020  • #3
Owen Muhlethaler (BFS)'s profile on
Hi Steve,

Not a problem, if you have any other questions, feel free to reach out to us.

Nov 24, 2020  • #4
Was this helpful?  (1)  
<< DiscussionsReply