using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace c_sharp_exe_calistirma_durdurma_islemi
{
public partial class exe_process_calistirma_kapama : Form
{
private System.Windows.Forms.Button btnStartProcess;
private System.Windows.Forms.Button btnStopAllProcesses;
private System.Windows.Forms.Button btnExeCalistir;
private System.Windows.Forms.Button btnCalisanExeleriKapat;
public exe_process_calistirma_kapama()
{
InitializeComponent();
InitializeMyComponent();
}
private static **** exe_Calistir()
{
//Çalıştırmak istenen işlemin exe uzantılı adresi
//belirtilerek process başlatılır
Process.Start(Environment.CurrentDirectory + "/program.exe");
}
private static **** exe_Kapat()
{
//kapatılmak istenen programı exe adı buraya yazılarak da exe durdurulur
Process[] process = System.Diagnostics.Process.GetProcessesByName("program");
if (process.Length > 0)
{
//Aynı process birden fazla çalışıyor olabilir
//Hepsini kapat
for (int i = 0; i < process.Length; i++)
{
//Eğer birden fazla aynı exr dosyası açılmışsa bu döngü ile bütün
// açlımış olan exe dosyaları durdurulur.
process.Kill();
}
}
}
private **** btnStartProcess_Click(object sender, EventArgs e)
{
// exe çalıştırma metodu
exe_Calistir();
}
private **** btnStopAllProcesses_Click(object sender, EventArgs e)
{
// exe durdurma metodu
exe_Kapat();
}
private **** exe_process_calistirma_kapama_Load(object sender, EventArgs e)
{
}
private **** btnExeCalistir_Click(object sender, EventArgs e)
{
// exe çalıştırma metodu
exe_Calistir();
}
private **** btnCalisanExeleriKapat_Click(object sender, EventArgs e)
{
// exe durdurma metodu
exe_Kapat();
}
private **** InitializeMyComponent()
{
this.btnStartProcess = new System.Windows.Forms.Button();
this.btnStopAllProcesses = new System.Windows.Forms.Button();
this.btnExeCalistir = new System.Windows.Forms.Button();
this.btnCalisanExeleriKapat = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnStartProcess
//
this.btnStartProcess.******** = new System.Drawing.Point(59, 56);
this.btnStartProcess.Name = "btnStartProcess";
this.btnStartProcess.Size = new System.Drawing.Size(75, 23);
this.btnStartProcess.TabIndex = 0;
this.btnStartProcess.Text = "Start Process ";
this.btnStartProcess.UseVisualStyleBackColor = true;
this.btnStartProcess.Click += new System.EventHandler(this.btnStartProcess_Click);
//
// btnStopAllProcesses
//
this.btnStopAllProcesses.******** = new System.Drawing.Point(166, 56);
this.btnStopAllProcesses.Name = "btnStopAllProcesses";
this.btnStopAllProcesses.Size = new System.Drawing.Size(145, 23);
this.btnStopAllProcesses.TabIndex = 1;
this.btnStopAllProcesses.Text = "Stop All Processes";
this.btnStopAllProcesses.UseVisualStyleBackColor = true;
this.btnStopAllProcesses.Click += new
System.EventHandler(this.btnStopAllProcesses_Click);
//
// btnExeCalistir
//
this.btnExeCalistir.******** = new System.Drawing.Point(59, 85);
this.btnExeCalistir.Name = "btnExeCalistir";
this.btnExeCalistir.Size = new System.Drawing.Size(75, 23);
this.btnExeCalistir.TabIndex = 2;
this.btnExeCalistir.Text = "Exe Çalıştırma";
this.btnExeCalistir.UseVisualStyleBackColor = true;
this.btnExeCalistir.Click += new System.EventHandler(this.btnExeCalistir_Click);
//
// btnCalisanExeleriKapat
//
this.btnCalisanExeleriKapat.******** = new System.Drawing.Point(166, 86);
this.btnCalisanExeleriKapat.Name = "btnCalisanExeleriKapat";
this.btnCalisanExeleriKapat.Size = new System.Drawing.Size(145, 23);
this.btnCalisanExeleriKapat.TabIndex = 3;
this.btnCalisanExeleriKapat.Text = "Çalışan Exe dosyalarını durdurma";
this.btnCalisanExeleriKapat.UseVisualStyleBackColor = true;
this.btnCalisanExeleriKapat.Click += new
System.EventHandler(this.btnCalisanExeleriKapat_Click);
//
// exe_process_calistirma_kapama
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(465, 178);
this.Controls.Add(this.btnCalisanExeleriKapat);
this.Controls.Add(this.btnExeCalistir);
this.Controls.Add(this.btnStopAllProcesses);
this.Controls.Add(this.btnStartProcess);
this.Name = "exe_process_calistirma_kapama";
this.Text = "EXE Çalıştırma Durdurma Programı";
this.Load += new System.EventHandler(this.exe_process_calistirma_kapama_Load);
this.ResumeLayout(false);
}
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Diagnostics;
namespace c_sharp_exe_calistirma_durdurma_islemi
{
public partial class exe_process_calistirma_kapama : Form
{
private System.Windows.Forms.Button btnStartProcess;
private System.Windows.Forms.Button btnStopAllProcesses;
private System.Windows.Forms.Button btnExeCalistir;
private System.Windows.Forms.Button btnCalisanExeleriKapat;
public exe_process_calistirma_kapama()
{
InitializeComponent();
InitializeMyComponent();
}
private static **** exe_Calistir()
{
//Çalıştırmak istenen işlemin exe uzantılı adresi
//belirtilerek process başlatılır
Process.Start(Environment.CurrentDirectory + "/program.exe");
}
private static **** exe_Kapat()
{
//kapatılmak istenen programı exe adı buraya yazılarak da exe durdurulur
Process[] process = System.Diagnostics.Process.GetProcessesByName("program");
if (process.Length > 0)
{
//Aynı process birden fazla çalışıyor olabilir
//Hepsini kapat
for (int i = 0; i < process.Length; i++)
{
//Eğer birden fazla aynı exr dosyası açılmışsa bu döngü ile bütün
// açlımış olan exe dosyaları durdurulur.
process.Kill();
}
}
}
private **** btnStartProcess_Click(object sender, EventArgs e)
{
// exe çalıştırma metodu
exe_Calistir();
}
private **** btnStopAllProcesses_Click(object sender, EventArgs e)
{
// exe durdurma metodu
exe_Kapat();
}
private **** exe_process_calistirma_kapama_Load(object sender, EventArgs e)
{
}
private **** btnExeCalistir_Click(object sender, EventArgs e)
{
// exe çalıştırma metodu
exe_Calistir();
}
private **** btnCalisanExeleriKapat_Click(object sender, EventArgs e)
{
// exe durdurma metodu
exe_Kapat();
}
private **** InitializeMyComponent()
{
this.btnStartProcess = new System.Windows.Forms.Button();
this.btnStopAllProcesses = new System.Windows.Forms.Button();
this.btnExeCalistir = new System.Windows.Forms.Button();
this.btnCalisanExeleriKapat = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// btnStartProcess
//
this.btnStartProcess.******** = new System.Drawing.Point(59, 56);
this.btnStartProcess.Name = "btnStartProcess";
this.btnStartProcess.Size = new System.Drawing.Size(75, 23);
this.btnStartProcess.TabIndex = 0;
this.btnStartProcess.Text = "Start Process ";
this.btnStartProcess.UseVisualStyleBackColor = true;
this.btnStartProcess.Click += new System.EventHandler(this.btnStartProcess_Click);
//
// btnStopAllProcesses
//
this.btnStopAllProcesses.******** = new System.Drawing.Point(166, 56);
this.btnStopAllProcesses.Name = "btnStopAllProcesses";
this.btnStopAllProcesses.Size = new System.Drawing.Size(145, 23);
this.btnStopAllProcesses.TabIndex = 1;
this.btnStopAllProcesses.Text = "Stop All Processes";
this.btnStopAllProcesses.UseVisualStyleBackColor = true;
this.btnStopAllProcesses.Click += new
System.EventHandler(this.btnStopAllProcesses_Click);
//
// btnExeCalistir
//
this.btnExeCalistir.******** = new System.Drawing.Point(59, 85);
this.btnExeCalistir.Name = "btnExeCalistir";
this.btnExeCalistir.Size = new System.Drawing.Size(75, 23);
this.btnExeCalistir.TabIndex = 2;
this.btnExeCalistir.Text = "Exe Çalıştırma";
this.btnExeCalistir.UseVisualStyleBackColor = true;
this.btnExeCalistir.Click += new System.EventHandler(this.btnExeCalistir_Click);
//
// btnCalisanExeleriKapat
//
this.btnCalisanExeleriKapat.******** = new System.Drawing.Point(166, 86);
this.btnCalisanExeleriKapat.Name = "btnCalisanExeleriKapat";
this.btnCalisanExeleriKapat.Size = new System.Drawing.Size(145, 23);
this.btnCalisanExeleriKapat.TabIndex = 3;
this.btnCalisanExeleriKapat.Text = "Çalışan Exe dosyalarını durdurma";
this.btnCalisanExeleriKapat.UseVisualStyleBackColor = true;
this.btnCalisanExeleriKapat.Click += new
System.EventHandler(this.btnCalisanExeleriKapat_Click);
//
// exe_process_calistirma_kapama
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(465, 178);
this.Controls.Add(this.btnCalisanExeleriKapat);
this.Controls.Add(this.btnExeCalistir);
this.Controls.Add(this.btnStopAllProcesses);
this.Controls.Add(this.btnStartProcess);
this.Name = "exe_process_calistirma_kapama";
this.Text = "EXE Çalıştırma Durdurma Programı";
this.Load += new System.EventHandler(this.exe_process_calistirma_kapama_Load);
this.ResumeLayout(false);
}
}
}