private void button_Crash_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(textBox_PID.Text) || !int.TryParse(textBox_PID.Text, out var pid) || !CrashInjecter.Crash(pid)) { MessageBox.Show("Please tell me the process ID!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
static void Main() { string[] args = Environment.GetCommandLineArgs(); if (args.Length == 2 || args.Length == 3) { if (!CrashInjecter.Crash(args)) { MessageBox.Show( @"Usage: CrashIt [ProcessName] [Optional:ProcessTitle]" + Environment.NewLine + @"Example: CrashIt newconsole setup" + Environment.NewLine + Environment.NewLine + @"Usage: CrashIt [id:ProcessID]" + Environment.NewLine + @"Example: CrashIt id:100", @"No Process to crash!"); } return; } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new CrashIt()); }