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
Restore Window Positions Using Window Titles (Layout1)
Return to DisplayFusion Scripted Functions (Macros)
Description
This function will restore the window positions using the values stored in the registry from running "Save Window Positions Using Window Titles (Layout1)" script.
Language
C#.net
Minimum Version
7.3.1+
Created By
Keith Lammers (BFS)
Contributors
-
Date Created
Sep 25, 2015
Date Last Modified
Nov 11, 2015
Scripted Function (Macro) Code
Copy
Select All
using System; using System.Drawing; public static class DisplayFusionFunction { public static void Run(IntPtr windowHandle) { // You can duplicate this script, then change layoutID to something different to save another layout string layoutID = "Layout1"; IntPtr[] windowHandles = BFS.Window.GetVisibleWindowHandles(); // If the window title is not empty, try to restore its position from the ones saved to the registry using the "Save Window Positions Using Window Title (Layout1)" script foreach (IntPtr window in windowHandles) { string windowTitle = BFS.Window.GetText(window); if (windowTitle != "") { int windowX; int windowY; int windowWidth; int windowHeight; int.TryParse(BFS.ScriptSettings.ReadValue(windowTitle + "_X_" + layoutID), out windowX); int.TryParse(BFS.ScriptSettings.ReadValue(windowTitle + "_Y_" + layoutID), out windowY); int.TryParse(BFS.ScriptSettings.ReadValue(windowTitle + "_Width_" + layoutID), out windowWidth); int.TryParse(BFS.ScriptSettings.ReadValue(windowTitle + "_Height_" + layoutID), out windowHeight); if (windowWidth > 0) { BFS.Window.SetSizeAndLocation(window, windowX, windowY, windowWidth, windowHeight); } } } } }