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?

User Image
Chris Christensen
3 discussion posts
I have a 3 monitor set up as you can see in the screenshot. I have 2 normal monitors on the left and right, and a Cisco Desk Pro in the middle. This is a video unit that I use for calls. When I start a call, the desktop goes into the background and I have to make some swipes to get backt to that screen. Kind of annoying. The other thing that happens and never seems to fail is when I open a new window of anything, it opens on that monitor.

I tried setting up a function to move all windows on a monitor to the next one. It works GREAT. However, occasionally the monitor numbers will change and #2 becomes #3, etc. In the screenshot, you can see that my code is now wrong and should be #2 instead of #4. This also happens a lot when I undock/redock.

Is there any way to get the monitor ID based on the location, monitor name, etc? Anything to always select the same monitor and not care about the number? Or a better way to accomplish this?
• Attachment: Screenshot 2024-09-16 092606.png [153,739 bytes]
Screenshot 2024-09-16 092606.png
Screenshot 2024-09-16 092606.png
• Attachment: Screenshot 2024-09-16 092640.png [62,073 bytes]
Screenshot 2024-09-16 092640.png
Screenshot 2024-09-16 092640.png
17 days ago (modified 17 days ago)  • #1
Owen Muhlethaler (BFS)'s profile on WallpaperFusion.com
Hi Chris,

If the ID you want is always the middle monitor, BFS.Monitors.GetMonitorIDs should get them in order from left to right, so something like this should work:

Code

uint monitorID = BFS.Monitor.GetMonitorIDs()[1]


The [1] index will get the second one one in the array (which should be the middle monitor)

Hope that helps!
15 days ago  • #2
User Image
Chris Christensen
3 discussion posts
This didn't seem to work. My monitors are 2-4-3 right now with the middle one being the one I'm looking for. I put this line in my code instead of the original "uint monitorID = 2" and it moved everything from the right monitor to the middle...

Quote:
Hi Chris,

If the ID you want is always the middle monitor, BFS.Monitors.GetMonitorIDs should get them in order from left to right, so something like this should work:

Code

uint monitorID = BFS.Monitor.GetMonitorIDs()[1]


The [1] index will get the second one one in the array (which should be the middle monitor)

Hope that helps!
15 days ago  • #3
User Image
Chris Christensen
3 discussion posts
This seems to work fine. I obviously know the resolutions of my monitors so this should be finding the monitor containing these XY coordinates, which should be the second from the left.

Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
    public static void Run(IntPtr windowHandle)
    {
        // Set the Monitor ID you want to move the windows from
        // uint monitorID = BFS.Monitor.GetMonitorIDs()[1];
        uint monitorID = BFS.Monitor.GetMonitorIDByXY(4300, 300);

        // Loop through the visible windows on the monitor and move them to the monitor that has the mouse cursor
        foreach (IntPtr window in BFS.Window.GetVisibleWindowHandlesByMonitor(monitorID))
        {
            BFS.DisplayFusion.RunFunctionWithWindowHandle("Move Window to Next Monitor", window);
        }   
    }
}
9 days ago (modified 9 days ago)  • #4
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)