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
Rollup Inactive Windows To Title Bar
Return to DisplayFusion Scripted Functions (Macros)
Description
This function will roll up windows to the title bar that haven't been focused for 30 seconds.
Language
C# (.Net)
Minimum Version
7.1.0+
Created By
Thomas Malloch (BFS)
Contributors
-
Date Created
Feb 3, 2015
Date Last Modified
Feb 3, 2015
Scripted Function (Macro) Code
Copy
Select All
Toggle Line Wrapping
using System; using System.Drawing; using System.Collections.Generic; // 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) { //a dictionary type to store the window handle and an approximate time Dictionary<IntPtr, int> watchedWindows = new Dictionary<IntPtr, int>(); while(true) { //store the currently focused window IntPtr focusedWindow = BFS.Window.GetFocusedWindow(); //if the focused window is in the watched windows, reset the timer if(watchedWindows.ContainsKey(focusedWindow)) watchedWindows[focusedWindow] = 0; //get a list of all of the visible window handles List<IntPtr> windows = new List<IntPtr>(BFS.Window.GetVisibleWindowHandles()); //loop though all of the visible windows foreach(IntPtr window in windows) { //check if this window is already rolled up if(BFS.Window.IsWindowRolledUpToTitleBar(window)) continue; //if this is a new window, add it to the list and continue if(!watchedWindows.ContainsKey(window)) { watchedWindows.Add(window, 0); continue; } //increment the time by 1 watchedWindows[window]++; //if the time is greater or equal to 30, roll up the window and remove it from the list if(watchedWindows[window] >= 30) { BFS.Window.RollupWindowToTitleBar(window); watchedWindows.Remove(window); } } //make a list to store windows that have been closed/minimized List<IntPtr> windowsToRemove = new List<IntPtr>(); //look for windows that aren't visible anymore foreach(IntPtr key in watchedWindows.Keys) { //sequencial lookup, but the list size shouldn't ever be very big (>500) if(!windows.Contains(key)) windowsToRemove.Add(key); } foreach(IntPtr window in windowsToRemove) watchedWindows.Remove(window); //pause for one second BFS.General.Sleep(1000); } } }
Copyright © 2007-2021 Binary Fortress Software
•
News
•
Discussions
•
FAQ
•
Support
•
Privacy
•
ToS
•
Get DisplayFusion Merch