Binary Fortress
Binary Fortress Software
CheckCentral
ClipboardFusion
CloudShow
CloudShow Manager
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
TrayStatus
VoiceBot
WallpaperFusion
Display
Fusion
by Binary Fortress Software
Download
Download
Change Log
Download Beta
Beta Change Log
License (EULA)
Features
Free vs Pro
More
Screenshots
Scripted Functions (Macros)
Languages
Help
Help Guide
FAQ
Discussions
Contact Us
Find My License
Mailing Address
Advanced Settings
Purchase
Login / Register
WARNING: You currently have Javascript disabled!
This website will not function correctly without Javascript enabled.
Title
Message
OK
Confirm
Yes
No
Open 3 Sites Maximized on 3 Monitors (Internet Explorer)
Return to DisplayFusion Scripted Functions (Macros)
Description
This script will open three Internet Explorer windows with the specified URLs, and move them to monitors 1, 2, and 3 respectively.
Language
C#.net
Minimum Version
7.1.0+
Created By
Keith Lammers (BFS)
Contributors
-
Date Created
Jul 8, 2015
Date Last Modified
Jul 17, 2015
Scripted Function (Macro) Code
Copy
Select All
using System; using System.Drawing; using System.Runtime.InteropServices; // The 'windowHandle' parameter will contain the window handle for the: // - Active window when run by hotkey // - Window Location target when run by a Window Location 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 { //this is the function that we will use to enumerate through child windows [DllImport("user32.dll", PreserveSig = true, SetLastError = false, CharSet = CharSet.Unicode)] private static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, IntPtr lpszWindow ); public static void Run(IntPtr windowHandle) { string site1 = "https://www.displayfusion.com/"; string site2 = "https://www.checkcentral.cc/"; string site3 = "https://www.voicebot.net/"; //open site1 and move it to monitor 1 BFS.Application.Start("C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe", site1); BFS.General.ThreadWait(3000); BFS.Window.MoveToMonitorMaximized(1, GetIE11WindowByURL(site1)); BFS.General.ThreadWait(1000); //open site2 and move it to monitor 2 BFS.Application.Start("C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe", site2); BFS.General.ThreadWait(3000); BFS.Window.MoveToMonitorMaximized(2, GetIE11WindowByURL(site2)); BFS.General.ThreadWait(1000); //open site3 and move it to monitor 3 BFS.Application.Start("C:\\Program Files (x86)\\Internet Explorer\\iexplore.exe", site3); BFS.General.ThreadWait(3000); BFS.Window.MoveToMonitorMaximized(3, GetIE11WindowByURL(site3)); } //this function will accept a url and try to find an IE11 window with this url open in it private static IntPtr GetIE11WindowByURL(string url) { //enumerate through all windows foreach(IntPtr handle in BFS.Window.GetAllWindowHandles()) { //if it isn't a IE window, continue if(BFS.Application.GetMainFileByWindow(handle).IndexOf("iexplore.exe", StringComparison.OrdinalIgnoreCase) == -1) continue; //if it's not the type of IE window we want, continue if(!BFS.Window.GetClass(handle).Equals("IEFrame", StringComparison.Ordinal)) continue; //we found the IE window, try to find the address bar by searching through the levels. The address bar's class is called "Edit" IntPtr addressBarHandle = FindWindowEx(handle, IntPtr.Zero, "WorkerW", IntPtr.Zero); addressBarHandle = FindWindowEx(addressBarHandle, IntPtr.Zero, "ReBarWindow32", IntPtr.Zero); addressBarHandle = FindWindowEx(addressBarHandle, IntPtr.Zero, "Address Band Root", IntPtr.Zero); addressBarHandle = FindWindowEx(addressBarHandle, IntPtr.Zero, "Edit", IntPtr.Zero); //if we couldn't find the address bar, continue if(addressBarHandle == IntPtr.Zero) continue; //if the addressbar contains the url, return the parent window if(BFS.Window.GetText(addressBarHandle).Equals(url, StringComparison.OrdinalIgnoreCase)) return handle; } //if we got this far we couldnt find anything. return IntPtr.Zero (null) return IntPtr.Zero; } }