Program pembunuh

Bagi yang punya teman sering menggunakan komputer kita dengan seenaknya sendiri dan tidak kenal waktu maka program ini akan sangat bermanfaat. Program ini akan membaca program tertentu yang ingin di pantau dan saat program-program itu running komputer akan otomatis mati.
HAHAHA.... Dibuat menggunakan C#.NET



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Windows.Forms;
namespace apa_aja
{
    class Program
    {

        static bool IsProcessOpen(string name)
        {
            //here we're going to get a list of all running processes on
            //the computer
            foreach (Process clsProcess in Process.GetProcesses())
            {
                //now we're going to see if any of the running processes
                //match the currently running processes. Be sure to not
                //add the .exe to the name you provide, i.e: NOTEPAD,
                //not NOTEPAD.EXE or false is always returned even if
                //notepad is running.
                //Remember, if you have the process running more than once,
                //say IE open 4 times the loop thr way it is now will close all 4,
                //if you want it to just close the first one it finds
                //then add a return; after the Kill
                if (clsProcess.ProcessName.Contains(name))
                {
                    //if the process is found to be running then we
                    //return a true
                    return true;
                }
            }
            //otherwise we return a false
            return false;
        }
        static void Main(string[] args)
        {
            Form form1 = new Form();
            Label label1 = new Label();
            Random random = new Random();
            NotifyIcon NI = new NotifyIcon();

            label1.Text = ("System32 has been shutting down. Windows fatal error");
           
            form1.Left = random.Next(2000);
            form1.Top = random.Next(2000);
            form1.Text = "Error";
            form1.Controls.Add(label1);

            if (IsProcessOpen("nama proses") && DateTime.Now.Hour >= 18)
            {
                DateTime datex = DateTime.Now;
                string paths = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\apa" + ".txt";

                StreamWriter SW;

                if (!File.Exists(paths))
                {
                    SW = File.CreateText(paths);
                    SW.WriteLine(DateTime.Now.ToString() + " Pemakaian komputer di luar jam kantor.");
                    SW.Close();
                }
                else
                {
                    SW = File.AppendText(paths);
                    SW.WriteLine(DateTime.Now.ToString() + " Pemakaian komputer di luar jam kantor.");

                }

                System.Diagnostics.Process.Start("shutdown", "/s /f /t 0 /c " + (char)34 + "YOUR COMPUTER WILL BE TURNED OFF IN 60 seconds" + (char)34);
            }
            else
            {
                Console.WriteLine("tidak ada");
            }          

        }
       
    }
}

Comments

Post a Comment

Popular posts from this blog

Flowchart Penjualan Grosir / Eceran

Flowchart Proses Pembelian Barang