using System;
using System.Drawing;
public static class DisplayFusionFunction
{
public static void Run(IntPtr windowHandle)
{
while (true)
{
if (!zoomIsVisible())
{
// Wait 30 seconds and check again to make sure it's really not visible
BFS.General.ThreadWait(30000);
if (!zoomIsVisible())
{
// Kill all Zoom.exe processes
while (BFS.Application.IsAppRunningByFile("*Zoom.exe"))
{
BFS.Application.Kill(BFS.Application.GetAppIDByFile("*Zoom.exe"));
BFS.General.ThreadWait(1000);
}
}
}
// Wait 10 seconds before starting over
BFS.General.ThreadWait(10000);
}
}
public static bool zoomIsVisible()
{
// Get all visible and minimized windows
IntPtr[] visibleWindows = BFS.Window.GetVisibleAndMinimizedWindowHandles();
// Loop through and if any match the Zoom classes, return Zoom as being visible
foreach (IntPtr window in visibleWindows)
{
if (BFS.Window.GetClass(window) == "ZPPTMainFrmWndClassEx" || BFS.Window.GetClass(window) == "ZPContentViewWndClass" )
{
return true;
break;
}
}
// If we got here, there were no visible or minimized Zoom windows
return false;
}
}