/// <summary> /// Find and return a handle on the first window with the specified title. /// </summary> /// <param name="windowTitle">The title of the window.</param> /// <returns>The handle to the window.</returns> public static IntPtr Get(string windowTitle) { IntPtr hWnd = WinAPI.FindWindow(null, windowTitle); if (hWnd == IntPtr.Zero) { throw new Exception("Window not found."); } return(hWnd); }
/// <summary> /// Check if a particular window is open. /// </summary> /// <param name="windowTitle">The title of the window.</param> /// <returns>True if the window is open.</returns> public static bool DoesExist(string windowTitle) { IntPtr hWnd = WinAPI.FindWindow(null, windowTitle); return(hWnd != IntPtr.Zero); }