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
Emulated Win+Right in Surround Mode
Return to DisplayFusion Scripted Functions (Macros)
Description
This function brings back the multi-monitor behaviour of the Win+Right command, while in Eyefinity or Nvidia Surround modes. It will also save and restore the size of a single program that is moved through this or its partner function.
Language
C#.net
Minimum Version
7.2.0+
Created By
DragRedSim
Contributors
-
Date Created
Jul 17, 2015
Date Last Modified
Jul 17, 2015
Scripted Function (Macro) Code
Copy
Select All
using System; using System.Drawing; // 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 { public static void Run(IntPtr windowHandle) { //check to see if there was an error, if there was, exit function if (windowHandle == IntPtr.Zero) return; //get the position of the window in the monitor, and the current monitor Rectangle windowRect = BFS.Window.GetBounds(windowHandle); Rectangle currentMonitorRect = BFS.Monitor.GetMonitorBoundsByWindow(windowHandle); decimal winTransparency = BFS.Window.GetTransparency(windowHandle); // if the window is not already in halfscreen, move to the RIGHT half. // is window already in RIGHT halfscreen mode? if ( ( windowRect.Width == currentMonitorRect.Width / 2 ) && ( windowRect.X == currentMonitorRect.X + ( currentMonitorRect.Width / 2 ) ) ) { //if we got this far then the window is in RIGHT halfscreen mode //move the window to the LEFT side of the next monitor BFS.Window.SetTransparency(windowHandle, 0); BFS.Window.MoveToNextMonitor(windowHandle); BFS.Window.MoveToLeftMonitorHalf(windowHandle); BFS.Window.SetTransparency(windowHandle, winTransparency); return; } // so it's not in RIGHT halfscreen mode. is it in LEFT halfscreen? if ( ( windowRect.Width == currentMonitorRect.Width / 2 ) && ( windowRect.X == currentMonitorRect.X ) ) { //LEFT halfscreen. we want this one to restore to user size, based on the earlier details. //BFS.Window.Restore(windowHandle); // does this window match the last one recorded? if ( BFS.Application.GetMainFileByWindow(windowHandle) == BFS.ScriptSettings.ReadValue("EmuWinLRWindowName") ) { //okay, the info is for this window. let's get the values out and resize/move the window. int NewXPos = Convert.ToInt32(BFS.ScriptSettings.ReadValue("EmuWinLRXPos")); int NewYPos = Convert.ToInt32(BFS.ScriptSettings.ReadValue("EmuWinLRYPos")); int NewWidth = Convert.ToInt32(BFS.ScriptSettings.ReadValue("EmuWinLRWidth")); int NewHeight = Convert.ToInt32(BFS.ScriptSettings.ReadValue("EmuWinLRHeight")); // Got the values, but they're for monitor 1. No matter, we'll get the offset, then add it back in. NewXPos = NewXPos + currentMonitorRect.X; BFS.Window.SetSizeAndLocation(windowHandle, NewXPos, NewYPos, NewWidth, NewHeight); return; } // nope, the info isn't for this window. move on to sending it to RIGHT halfscreen. BFS.Window.MoveToRightMonitorHalf(windowHandle); return; } // Not RIGHT halfscreen, not LEFT halfscreen. Save the details, and then send it to RIGHT halfscreen. // We need the info to be monitor-agnostic, so the XPos value needs to be no more than the width of the screen. How do we do that? By mod division by the width of the screen. int CalculatedXPos = windowRect.X % currentMonitorRect.Width; BFS.ScriptSettings.WriteValue("EmuWinLRWindowName", BFS.Application.GetMainFileByWindow(windowHandle)); BFS.ScriptSettings.WriteValue("EmuWinLRXPos", Convert.ToString(CalculatedXPos)); BFS.ScriptSettings.WriteValue("EmuWinLRYPos", Convert.ToString(windowRect.Y)); BFS.ScriptSettings.WriteValue("EmuWinLRWidth", Convert.ToString(windowRect.Width)); BFS.ScriptSettings.WriteValue("EmuWinLRHeight", Convert.ToString(windowRect.Height)); BFS.Window.MoveToRightMonitorHalf(windowHandle); } }