⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 clsprocessthread.cs

📁 原创: 外挂网站刷IP程序的源码 自动ADSL拨号刷新IP,可录制鼠标模拟点击自动点击操作,统计点击数,自动清除COOKIES记录
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;

namespace qdog
{
    class clsProcessThread
    {
        string m_strTitle;
        public void FindPopupToKill(Process p)
        {

            // traverse all threads and enum all windows attached to the thread
            m_strTitle = p.ProcessName;
            foreach (ProcessThread t in p.Threads)
            {
                int threadId = t.Id;

                NativeWIN32.EnumThreadProc callbackProc = new NativeWIN32.EnumThreadProc( MyEnumThreadWindowsProc);

                NativeWIN32.EnumThreadWindows(threadId, callbackProc, IntPtr.Zero /*lParam*/);

            } 
        }


        // callback used to enumerate Windows attached to one of the threads
        bool MyEnumThreadWindowsProc(IntPtr hwnd, IntPtr lParam)
        {
            //const int WM_SYSCOMMAND = 0x0112;

            //const int SC_CLOSE = 0xF060;

            // get window caption

            NativeWIN32.STRINGBUFFER sLimitedLengthWindowTitle;

            NativeWIN32.GetWindowText( hwnd,out sLimitedLengthWindowTitle, 256);

            String sWindowTitle = sLimitedLengthWindowTitle.szText;

            if(sWindowTitle.Length==0) return true;

            // find this caption in the list of banned captions

            if (sWindowTitle.StartsWith(m_strTitle))
                    NativeWIN32.SendMessage(hwnd, NativeWIN32.WM_SYSCOMMAND,NativeWIN32.SC_CLOSE,(int)IntPtr.Zero); // try soft kill


            return true;

        }

    }


    public class NativeWIN32
    {
        public const int WM_SYSCOMMAND = 0x0112;

        public const int SC_CLOSE = 0xF060;

        public delegate bool EnumThreadProc(IntPtr hwnd, IntPtr lParam);

        [DllImport("user32.dll", CharSet=CharSet.Auto)]
        public static extern bool EnumThreadWindows(int threadId, EnumThreadProc pfnEnum, IntPtr lParam);

        // used for an output LPCTSTR parameter on a method call
        [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
        public struct STRINGBUFFER
        {
            [MarshalAs(UnmanagedType.ByValTStr, SizeConst=256)]
                public string szText;
        }

        [DllImport("user32.dll", CharSet=CharSet.Auto)]
        public static extern int GetWindowText(IntPtr hWnd, out STRINGBUFFER ClassName, int nMaxCount);

        [DllImport("user32.dll", CharSet=CharSet.Auto)]
        public static extern int SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);

    }


    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -