private void ProcessSetter() { List <IntPtr> processes = WindowManagement.FindWindowsWithText(ProcessName.Text.Trim(), true); if (processes.Count > 0) { procSet = true; PrcNameLbl.Text = "Window Title Name: Set"; } else { MessageBox.Show("No windows were found with \"" + ProcessName.Text.Trim() + "\" in the title"); PrcNameLbl.Text = "Window Title Name: Not Set"; ProcessName.Text = "Enter the window title"; procSet = false; } }
private void Start_Click(object sender, EventArgs e) { if (Directory.GetFiles(SelectectedFolder.Text, "*", SearchOption.TopDirectoryOnly).Length > 0) { MessageBox.Show("In order to work properly Book Snatcher needs to save to an empty folder" + NL() + "Please create a new folder to use"); SelectectedFolder.Text = "Choose a folder for the screenshots to go"; } else if (started == false && (Directory.GetFiles(SelectectedFolder.Text, "*", SearchOption.TopDirectoryOnly).Length < 1)) { started = true; if (WindowManagement.FindWindowsWithText(ProcessName.Text.Trim(), true).Count > 0) { readerhWnd = WindowManagement.FindWindowsWithText(ProcessName.Text.Trim(), true)[0]; } else { MessageBox.Show("No windows with \"" + ProcessName.Text.Trim() + "\" in the title were found"); return; } this.Width = 548; i = 1; HowDoIScreenShotted(); SetForegroundWindow(this.Handle); if (i == numberOfPages + 1) { MessageBox.Show("Done!" + NL() + numberOfPages.ToString() + " screenshots." + NL() + "Saved to: " + SelectectedFolder.Text); started = false; Tracker(); this.Width = 473; } } }