private void btnSelectWindow_Click(object sender, EventArgs e) { if (DialogResult.OK == MessageBox.Show( "After you click \"OK\" this dialog you'll have 3 seconds to select the window the keys will be send to", "Select your desired window", MessageBoxButtons.OKCancel, MessageBoxIcon.Information)) { Thread.Sleep(3000); this._hiveServerSystem.Window = NativeWin32.GetActiveProcessWindow(); this.lblCurrentWindow.Text = this._hiveServerSystem.Window.Title; if (DialogResult.Yes != MessageBox.Show("Is " + this._hiveServerSystem.Window.Title + " the window you want?", "Are you sure?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question)) { this._hiveServerSystem.Window = new NativeWin32.ProcessWindow(new IntPtr(), "nowindowselectedinputhive"); this.lblCurrentWindow.ForeColor = Color.DarkRed; this.lblCurrentWindow.Text = "None"; } else { this.lblCurrentWindow.ForeColor = Color.Green; this.lblCurrentWindow.Text = this._hiveServerSystem.Window.Title; } } }