using System; using System.Collections.Generic; IntPtr handle; if( IsClipboardManagerOpen(out handle) ) { // Close the ClipboardManager BFS.Window.Close(handle); } // This isn't the private static bool IsClipboardManagerOpen(out IntPtr handle) { handle = IntPtr.Zero; // Loop through all visible windows and look for a window with the right title that is run by the ClipboardFusion process foreach(IntPtr window in BFS.Window.GetVisibleWindowHandles()) { if(BFS.Window.GetText(window).IndexOf("ClipboardFusion", StringComparison.OrdinalIgnoreCase) != 0) continue; if(BFS.Application.GetMainFileByWindow(window).IndexOf("clipboardfusion.exe", StringComparison.OrdinalIgnoreCase) == -1) continue; // Set the handle to the window we found handle = window; return true; } // If we got this far, that means we didn't find anything return false; }