<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/">
<channel>
<title>DisplayFusion RSS: Replacing 1 Mirrored Window with another?</title>
<atom:link href="https://www.displayfusion.com/Discussions/RSS/?TopicID=0196e54e-f331-73d9-a9c9-fe6d8599b958" rel="self" type="application/rss+xml" />
<link>https://www.displayfusion.com/Discussions/RSS/?TopicID=0196e54e-f331-73d9-a9c9-fe6d8599b958</link>
<description>DisplayFusion RSS: Replacing 1 Mirrored Window with another?</description>
<lastBuildDate>Thu, 09 Apr 2026 08:31:15 GMT</lastBuildDate>
<language>en</language>
<sy:updatePeriod>hourly</sy:updatePeriod>
<sy:updateFrequency>1</sy:updateFrequency>
<generator>https://www.displayfusion.com/Discussions/RSS/?TopicID=0196e54e-f331-73d9-a9c9-fe6d8599b958</generator>
<item>
<title>RE: Replacing 1 Mirrored Window with another?</title>
<link>https://www.displayfusion.com/Discussions/View/replacing-1-mirrored-window-with-another/?ID=0196e54e-f331-73d9-a9c9-fe6d8599b958#3</link>
<pubDate>Tue, 20 May 2025 14:51:11 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/replacing-1-mirrored-window-with-another/?ID=0196e54e-f331-73d9-a9c9-fe6d8599b958#3</guid>
<category>DisplayFusion</category>
<description><![CDATA[Thanks for sharing your solution!]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Thanks for sharing your solution!
</div>
]]></content:encoded>
</item>
<item>
<title>RE: Replacing 1 Mirrored Window with another?</title>
<link>https://www.displayfusion.com/Discussions/View/replacing-1-mirrored-window-with-another/?ID=0196e54e-f331-73d9-a9c9-fe6d8599b958#2</link>
<pubDate>Mon, 19 May 2025 04:36:15 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/replacing-1-mirrored-window-with-another/?ID=0196e54e-f331-73d9-a9c9-fe6d8599b958#2</guid>
<category>DisplayFusion</category>
<description><![CDATA[I figured it out with writing a # Script I will post it down below in case anyone else ever wants/needs this:
using System;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
using System.Drawing;
public static class DisplayFusionFunction
{
// Retrie...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
I figured it out with writing a # Script I will post it down below in case anyone else ever wants/needs this:<br/>
<br/>
using System;<br/>
using System.Runtime.InteropServices;<br/>
using System.Threading;<br/>
using System.Windows.Forms;<br/>
using System.Drawing;<br/>
<br/>
public static class DisplayFusionFunction<br/>
{<br/>
    // Retrieves the window handle at a given screen coordinate.<br/>
    [DllImport("user32.dll")]<br/>
    private static extern IntPtr WindowFromPoint(Point p);<br/>
<br/>
    // Retrieves the top level (root) window for a given window handle.<br/>
    [DllImport("user32.dll")]<br/>
    private static extern IntPtr GetAncestor(IntPtr hwnd, uint gaFlags);<br/>
    private const uint GA_ROOT = 2;<br/>
<br/>
    // Checks if a window is visible.<br/>
    [DllImport("user32.dll")]<br/>
    private static extern bool IsWindowVisible(IntPtr hWnd);<br/>
<br/>
    public static void Run()<br/>
    {<br/>
        try<br/>
        {<br/>
            // STEP 1: Close any existing mirror windows.<br/>
            // We search for windows that have a title text matching "*mirror window*".<br/>
            // (Adjust this search string if your mirror windows are labeled differently.)<br/>
            IntPtr[] mirrorWindows = BFS.Window.GetWindowsByText("*mirror window*");<br/>
            if (mirrorWindows != null && mirrorWindows.Length &gt; 0)<br/>
            {<br/>
                foreach (IntPtr wnd in mirrorWindows)<br/>
                {<br/>
                    if (wnd != IntPtr.Zero)<br/>
                        BFS.Window.Close(wnd);<br/>
                }<br/>
            }<br/>
            <br/>
            // Allow time for any existing mirror windows to close.<br/>
            Thread.Sleep(500);<br/>
<br/>
            // STEP 2: Get the mouse cursor's screen position.<br/>
            int mouseX = BFS.Input.GetMousePositionX();<br/>
            int mouseY = BFS.Input.GetMousePositionY();<br/>
            Point cursorPoint = new Point(mouseX, mouseY);<br/>
<br/>
            // STEP 3: Get the window handle directly under the cursor.<br/>
            IntPtr candidateWindow = WindowFromPoint(cursorPoint);<br/>
<br/>
            // STEP 4: Get the top-level (root) window of that candidate.<br/>
            IntPtr targetWindow = GetAncestor(candidateWindow, GA_ROOT);<br/>
<br/>
            if (targetWindow == IntPtr.Zero)<br/>
            {<br/>
                MessageBox.Show("No window was detected under the cursor.", "Mirror Error");<br/>
                return;<br/>
            }<br/>
<br/>
            // STEP 5: Verify that the window is visible.<br/>
            if (!IsWindowVisible(targetWindow))<br/>
            {<br/>
                MessageBox.Show("The window under your cursor is not visible.", "Mirror Error");<br/>
                return;<br/>
            }<br/>
<br/>
            // STEP 6: Mirror the target window.<br/>
            BFS.DisplayFusion.MirrorWindow(targetWindow);<br/>
        }<br/>
        catch (Exception ex)<br/>
        {<br/>
            MessageBox.Show("An error occurred: " + ex.Message, "Script Error");<br/>
        }<br/>
    }<br/>
}
</div>
]]></content:encoded>
</item>
<item>
<title>Replacing 1 Mirrored Window with another?</title>
<link>https://www.displayfusion.com/Discussions/View/replacing-1-mirrored-window-with-another/?ID=0196e54e-f331-73d9-a9c9-fe6d8599b958</link>
<pubDate>Sun, 18 May 2025 21:31:19 GMT</pubDate>
<dc:creator>Binary Fortress Software</dc:creator>
<guid isPermaLink="false">https://www.displayfusion.com/Discussions/View/replacing-1-mirrored-window-with-another/?ID=0196e54e-f331-73d9-a9c9-fe6d8599b958</guid>
<category>DisplayFusion</category>
<description><![CDATA[Hey Everyone! Just got this software today, so im a little overwhelmed with all the features. I did however figure out how to mirror specific windows which is what i was looking to do with this software but when I mirror another window the other one is still there and im looking to do one at a ti...]]></description>
<content:encoded><![CDATA[<div class="CTDiscussions">
Hey Everyone! Just got this software today, so im a little overwhelmed with all the features. I did however figure out how to mirror specific windows which is what i was looking to do with this software but when I mirror another window the other one is still there and im looking to do one at a time... Let me explain my reasoning.<br/>
<br/>
I have OBS and I have a capture card that I am using as an extended monitor to only capture what I want to be shown, I dont want to manually have to switch the input of my monitor in order to see whats on the screen in order to close out of a previous mirror. So lets say for example I am capturing gameplay, I use the Mirror Function, how I want to show a specific window like chrome I will then mirror that window... now there are 2 mirrors but I just want it to replace the current one with the most recent mirror is this possible? If it is possible how would I go about setting this up?
</div>
]]></content:encoded>
</item>
</channel>
</rss>