Merhaba Arkadaşlar, bu makalemizde Kill metodu ile Explorer , NotePad uygulamalarının nasıl sonlandırıldığını göreceğiz.
Form1.cs
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 WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public bool sonlandir(string isim)
        {
            foreach (Process kapatProcess in Process.GetProcesses())
            {
                if (kapatProcess.ProcessName.StartsWith(isim))
                {
                    kapatProcess.Kill();
                    return true;
                }
            }
            return false;
        }
        
        private void button1_Click(object sender, EventArgs e)
        {
            //Internet Explorer uygulamasını
            //sonlandırmak istersek;
            sonlandir("iexplore"); 
            //veya açık olan notepad i sonlandırmak
            //istersek
            //FindAndKillProcess("notepad"); 
        }
    }
}
Bir makalenin daha sonuna geldik. Bir sonraki makalede görüşmek dileğiyle. Hoşçakalın. Bahadır ŞAHİN
0 comments:
Yorum Gönder