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
WARNING: You currently have Javascript disabled!
This website will not function correctly without Javascript enabled.
Title
Message
OK
Confirm
Yes
No
Auto Win+Left/Right (Modified)
Return to DisplayFusion Scripted Functions (Macros)
Description
This is a customer modified Auto Win+Left/Right switcher which will snap your application to the left or right of the screen based on which half of your screen your application is mostly in at the moment.
Language
C# (.Net)
Minimum Version
9.5+
Created By
Mark Ozga
Contributors
Thomas Malloch (BFS)
Date Created
Nov 19, 2019
Date Last Modified
Nov 20, 2019
Scripted Function (Macro) Code
Copy
Select All
Toggle Line Wrapping
// This is a customer modified Auto Win+Left/Right switcher which will snap your application to the left or right of the screen based // on which half of your screen your application is mostly in at the moment. // BFS customer Mark Ozga (markozga@alumni.depaul.edu) has made changes to the original code to allow for 70%/30% splits // as one does in userspace via keyboard shortcuts and mouse gestures. // The script is invoked cleanly as a TitleBar Button or mapped to key auch as the seldom used Apps key. 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 monitorRect = BFS.Monitor.GetMonitorBoundsByWindow(windowHandle); //maths to imagine an imaginary dot at the top of every window int MiddleOfWindow = (windowRect.Width / 2); //maths used to determine if the imaginary dot will be on either side of an imaginery fence. int MiddleOfMonitor = (monitorRect.Width / 2); //maths used to determine the actual position of our imaginary dot within the confines of the screen int PositionOfWindow = (windowRect.X + MiddleOfWindow); //a test to determine if the middle of our application is closer to right side of the screen if( PositionOfWindow >= MiddleOfMonitor ) { //if we are here then the middle of our applications must be closer to the RIGHT side of the screen //let Windows to use its routines to snap it, restore it, or otherwise move the window BFS.Input.SendKeys("{WIN}({VK_39})"); } if( PositionOfWindow < MiddleOfMonitor ) { //if we are here we can assume the imaginary dot is closer to the LEFT side of the screen //let Windows to use its routines to snap it, restore it, or otherwise move the window BFS.Input.SendKeys("{WIN}({VK_37})"); } } }
Copyright © 2007-2021 Binary Fortress Software
•
News
•
Discussions
•
FAQ
•
Support
•
Privacy
•
ToS
•
Get DisplayFusion Merch