using System; using System.Drawing; using System.IO; // The 'windowHandle' parameter will contain the window handle for the: // - Active window when run by hotkey // - Trigger target when run by a Trigger 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) { //loop through all of the other visable windows and make them opaque foreach(IntPtr window in BFS.Window.GetAllWindowHandles()) { if(IsDisplayFusionWindowOrHiddenExplorerWindow(window)) continue; if(BFS.Window.GetTransparency(window) == 100) continue; //make the window opaque BFS.Window.SetTransparency(window, 100); } } private static bool IsDisplayFusionWindowOrHiddenExplorerWindow(IntPtr window) { //ignore any DisplayFusion windows (title bar buttons, etc.) //ignore pesky hidden explorer.exe windows if((BFS.Window.GetClass(window).StartsWith("DF", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("EdgeUiInputTopWndClass", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("EdgeUiInputWndClass", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("NativeHWNDHost", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("ModeInputWnd", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("MetroGhostWindow", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("ImmersiveLauncher", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("ApplicationManager_ImmersiveShellWindow", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("Shell_TrayWnd", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("WorkerW", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("Progman", StringComparison.OrdinalIgnoreCase)) || (BFS.Window.GetClass(window).Equals("SearchPane", StringComparison.OrdinalIgnoreCase))) { return true; } //windows 10 start menu and other things if(BFS.Application.GetMainFileByWindow(window).IndexOf("ShellExperienceHost.exe", StringComparison.OrdinalIgnoreCase) != -1) return true; return false; } }