public static IntPtr FindWindowByClass(string className) { foreach (var hwnd in WindowHelper.EnumAllWindows()) { if (WindowHelper.GetClassName(hwnd).Equals(className, StringComparison.Ordinal)) { return(hwnd); } } return(IntPtr.Zero); }
public static IntPtr FindWindowByTitle(string windowTitle) { foreach (var hwnd in WindowHelper.EnumAllWindows()) { if (WindowHelper.GetWindowText(hwnd).Equals(windowTitle, StringComparison.Ordinal)) { return(hwnd); } } return(IntPtr.Zero); }