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-Load Desktop Icon Profile
Return to DisplayFusion Scripted Functions (Macros)
Description
The function checks regularly, if the monitor setup has changed. In case of change it checks, if a corresponding Desktop Icon Profile exists and applies it. The profile name is built using the resolution and Y-position info of each monitor except the primary monitor where the Y-Position is 0.
I use this to automatically have the desktop icons arranged in my laptop, when I put it in a docking station or take it out.
Use the function 'Desktop Icon Profile - Auto-Save' to store your profiles with corresponding names. To make it work, place the following in your startup folder: \DisplayFusionCommand.exe -functionrun "Desktop Icon Profile - Auto-Load"
Language
C# (.Net)
Minimum Version
7.3.4+
Created By
Christian Treffler
Contributors
-
Date Created
Mar 1, 2016
Date Last Modified
Mar 1, 2016
Scripted Function (Macro) Code
Copy
Select All
Toggle Line Wrapping
using System; using System.Collections.Generic; using System.Drawing; using System.Text; // V1.0 // by: Christian Treffler // Thanks to kaweksl513742 whose code pointed me in the right direction to build this // // The function checks regularly, if the monitor setup has changed. // In case of change it checks, if a corresponding Desktop Icon Profile exists and applies it // The profile name is built using the resolution and Y-position info of each monitor // except the primary monitor where the Y-Position is 0 // // I use this to automatically have the desktop icons arranged in my laptop, // when I put it in a docking station or take it out // // Use the function 'Desktop Icon Profile - Auto-Save' to store your profiles with corresponding names // To make it work, place the following in your Autostart folder: // <PathToDisplayFusion>\DisplayFusionCommand.exe -functionrun "Desktop Icon Profile - Auto-Load" // public static class DisplayFusionFunction { public static void Run(IntPtr windowHandle) { // Refresh every n mseconds const int sleeptime = 3000; // Get Resolution of all Monitors Rectangle[] Monitors = BFS.Monitor.GetMonitorBounds(); // strings to compare current monitor setup with the last one string lastsetup = buildProfileName(Monitors); string currentsetup = lastsetup; // Apply corresponding profile immediately CheckAndLoad(currentsetup); while (true) { BFS.General.Sleep(sleeptime); // what's the current setup Monitors = BFS.Monitor.GetMonitorBounds(); currentsetup = buildProfileName(Monitors); if(currentsetup != lastsetup) // if changed { CheckAndLoad(currentsetup); lastsetup = currentsetup; } } } public static void CheckAndLoad(string setup) // Checks, if a Desktop Icon Profile exists dor the current setup // and if yes, applies it { // Get existing profiles string[] profiles = BFS.DisplayFusion.GetDesktopIconsProfiles(); for (int i = 0; i < profiles.Length; i++) { if(profiles[i] == setup) // If profiles exist { BFS.DisplayFusion.LoadDesktopIconsProfile(setup); break; } } } public static string buildProfileName(Rectangle[] screens) { // needs System.Text to have StringBuilder class StringBuilder pname = new StringBuilder(); for (int i = 0; i < screens.Length; i++) // For each monitor { // Add monitors resolution in the format "[<Width>x<Height>, <Y>]" pname.Append("["); pname.Append(screens[i].Width); pname.Append("x"); pname.Append(screens[i].Height); if(screens[i].X!=0 || screens[i].Y!=0) // Primary screen has coordinates [0,0] { // Add the y-coordinate, if not primary screen pname.Append(","); pname.Append(screens[i].Y); } pname.Append("]"); } return pname.ToString(); } }
Copyright © 2007-2021 Binary Fortress Software
•
News
•
Discussions
•
FAQ
•
Support
•
Privacy
•
ToS
•
Get DisplayFusion Merch