Login / Register
▼
Binary Fortress
Binary Fortress Software
CheckCentral
ClipboardFusion
CloudShow
DisplayFusion
FileSeek
HashTools
LogFusion
Notepad Replacer
Online Base64 Decoder
Online Base64 Encoder
Online JSON Formatter
ShellSend
TrayStatus
VoiceBot
WallpaperFusion
Window Inspector
More Apps...
DisplayFusion
CheckCentral
CloudShow
ClipboardFusion
FileSeek
VoiceBot
WallpaperFusion
Home
▼
Download
Download
Change Log
Download Beta
Beta Change Log
License (EULA)
▼
Features
Features
Incredible Desktop Wallpaper
Monitor Configuration
Monitor Splitting
Powerful Functions
Triggers
Multi-Monitor Taskbars
Useful Windows 10 Tweaks
Useful Windows 8 Tweaks
Windows Lock Screen
Multi-Monitor Screen Savers
Monitor Fading
Window Snapping
Window Management
Mouse Management
Alt+Tab Handler
Window Position Profiles
Desktop Icon Profiles
Remote Control
Available in dozens of Languages
Easy Administration
Free vs Pro
Purchase
Screenshots
Languages
▼
Help
Help Guide
FAQ
Discussions
Contact Us
Find My License
Mailing Address
Advanced Settings
Scripted Functions (Macros)
Display
Fusion
by Binary Fortress Software
WARNING: You currently have Javascript disabled!
This website will not function correctly without Javascript enabled.
Title
Message
OK
Confirm
Yes
No
Search for Window and Move it to Current Monitor
Return to DisplayFusion Scripted Functions (Macros)
Description
This script will show a list of open windows that is searchable. When you select one, it will move it to the current monitor.
Language
C# (.Net)
Minimum Version
9.6.1+
Created By
Keith Lammers (BFS)
Contributors
-
Date Created
May 15, 2020
Date Last Modified
May 15, 2020
Scripted Function (Macro) Code
Copy
Select All
using System; using System.Drawing; using System.Collections.Generic; public static class DisplayFusionFunction { public static void Run(IntPtr windowHandle) { // Get the current monitor based on the mouse position int mouseX = BFS.Input.GetMousePositionX(); int mouseY = BFS.Input.GetMousePositionY(); uint currentMonitorID = BFS.Monitor.GetMonitorIDByXY(mouseX, mouseY); // Get a list of open windows for all monitors Dictionary<string, IntPtr> windows = new Dictionary<string, IntPtr>(); foreach (IntPtr window in BFS.Window.GetVisibleAndMinimizedWindowHandles()) { if (IsDisplayFusionWindowOrHiddenExplorerWindow(window)) continue; string title = BFS.Window.GetText(window); if(string.IsNullOrEmpty(title)) continue; if(windows.ContainsKey(title)) { int i; for(i = 1; windows.ContainsKey(title + "(" + i + ")") ; i++) { } windows.Add(title + "(" + i + ")", window); } else { windows.Add(title, window); } } // Show a dialog allowing the user to select the window string selectedWindow = BFS.Dialog.GetUserInputListViewWithFilter("Select the window to move...", new List<string>(windows.Keys).ToArray()); // Move the window to the current monitor BFS.Window.MoveToMonitor(currentMonitorID, windows[selectedWindow]); } private static bool IsDisplayFusionWindowOrHiddenExplorerWindow(IntPtr window) { //ignore any DisplayFusion windows (title bar buttons, etc.) //ignore pesky hidden explorer.exe windows if((BFS.Window.GetClass(window).StartsWith("DF", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("EdgeUiInputTopWndClass", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("EdgeUiInputWndClass", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("NativeHWNDHost", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("ModeInputWnd", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("MetroGhostWindow", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("ImmersiveLauncher", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("ApplicationManager_ImmersiveShellWindow", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("Shell_TrayWnd", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("WorkerW", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("Progman", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("SearchPane", StringComparison.OrdinalIgnoreCase))) { return true; } return false; } }
Copyright © 2007-2021 Binary Fortress Software
•
News
•
Discussions
•
FAQ
•
Support
•
Privacy
•
ToS
•
Get DisplayFusion Merch