using System; using System.Drawing; public static class DisplayFusionFunction { static int mouseX=0; static int mouseY=0; static bool maximizeTriggerFired = true; public static void Run(IntPtr windowHandle) { IntPtr torWindow = BFS.Application.GetMainWindowByFile("*java.exe"); while(true){ if(torWindow == IntPtr.Zero){ torWindow = BFS.Application.GetMainWindowByFile("*java.exe"); } BFS.General.ThreadWait(50); if(torWindow == IntPtr.Zero){continue;} //If the window does not exist, do nothing if(BFS.Window.IsMaximized(torWindow)){continue;} //If the windows is already maximized, do nothing if(BFS.Application.GetMainWindowByFile("*TeamViewer.exe") != IntPtr.Zero){continue;} //If teamviewer is running, do nothing //If mouse has been moved, maximize the window. The code cannot reach here if the window is already maximized, due to previous if-statement. if(BFS.Input.GetMousePositionX() != mouseX || BFS.Input.GetMousePositionY() != mouseY){ mouseX = BFS.Input.GetMousePositionX(); mouseY = BFS.Input.GetMousePositionY(); BFS.Window.Maximize(torWindow); } } } }