Processing Ajax...

Title
Close Dialog

Message

Confirm
Close Dialog

Confirm
Close Dialog

Confirm
Close Dialog

User Image
numericOverflow
2 discussion posts
Using a scripted function, I'm trying to move all windows from chrome to a specific monitor.

This works great for moving a single window, but if I have multiple windows open, only one is moved. Is there a function that will grab *all* matching windows instead of just main?

Code

//get the window handle of a specific application
            IntPtr chrome = BFS.Application.GetMainWindowByFile("*chrome.exe");
            //if we couldn't get the skype window, exit the function
            if (chrome != IntPtr.Zero) {
                //move the window
                BFS.Window.MoveToMonitor(rightMonNumber, chrome);

            }
Jul 31, 2017 (modified Aug 2, 2017)  • #1
Keith Lammers (BFS)'s profile on WallpaperFusion.com
Try this out :)

Code

using System;
using System.Drawing;

public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
        // Set the monitor number
        uint rightMonNumber = 401;

// Get all window handles
IntPtr[] windows = BFS.Window.GetAllWindowHandles();

// Loop through the window handles and move any that belong to chrome.exe
foreach (IntPtr window in windows)
{
            if (BFS.Application.GetMainFileByWindow(window).Contains("chrome.exe"))
                BFS.Window.MoveToMonitor(rightMonNumber, window);

}
}
}
Aug 1, 2017  • #2
User Image
numericOverflow
2 discussion posts
That works great, thanks!
Aug 2, 2017  • #3
Subscribe to this discussion topic using RSS
Was this helpful?  Login to Vote(-)  Login to Vote(-)