private void CaptureOptions_Load(object sender, EventArgs e) { WindowDropdown.Items.Clear(); WindowHandle = IntPtr.Zero; ExternalAPI.EnumWindows(new ExternalAPI.EnumWindowsProc(EnumWindowsCallback), IntPtr.Zero); foreach (WindowData Data in WindowDropdown.Items) { if (Data.Name.Equals(WindowName, StringComparison.InvariantCultureIgnoreCase)) { if (MatchTitle) { if (Data.Title != WindowTitle) { continue; } } WindowDropdown.SelectedItem = Data; break; } } MatchTitleCheck.Checked = MatchTitle; TopmostOnlyCheck.Checked = TopmostOnly; MethodDropdown.SelectedIndex = (int)Method; }
private IntPtr FindWindow(string ProcessName, string WindowTitle, bool MatchTitle) { FindProcessCallback.Name = ProcessName; FindProcessCallback.Title = WindowTitle; FindProcessCallback.MatchTitle = MatchTitle; FindProcessCallback.Handle = IntPtr.Zero; ExternalAPI.EnumWindows(new ExternalAPI.EnumWindowsProc(FindProcessCallback.EnumWindowsCallback), IntPtr.Zero); return(FindProcessCallback.Handle); }