请问如何写钩子程序能够钩住其他软件的TEXTBOX控件,并能获得系统传给他的值. 我觉得你用GetWindowText就可以做到啊取值啊. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://dev.csdn.net/develop/article/37/37848.shtm应该一样的道理 http://dev.csdn.net/develop/article/53/53147.shtm-----------------------------假如对textbox控件加密了你该怎么办 ?除非你能锁定程序的textbox控件,要不就只能获得键盘信息 ! 你是想截取键盘输入吧参考一下http://dev.csdn.net/develop/article/53/53147.shtm 鼠标钩子:http://dev.csdn.net/develop/article/41/41301.shtm参考函数:那就用Hook了,参考如下的函数://装置钩子的函数[DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);//卸下钩子的函数(已用C#语法修改过,可以直接用)[DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]public static extern bool UnhookWindowsHookEx(int idHook);[DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]public static extern int CallNextHookEx(int idHook, int nCode, Int32 wParam, IntPtr lParam); [DllImport("user32")] public static extern int GetKeyboardState(byte[] pbKeyState);public delegate int HookProc(int nCode, Int32 wParam, IntPtr lParam); http://blog.joycode.com/mvm/archive/2004/10/18/35790.aspx这个应该够参考吧 using System.Reflection;[DllImport("user32.dll", EntryPoint="FindWindow")]public static extern int FindWindow (string lpClassName,string lpWindowName);[DllImport("user32.dll", EntryPoint="FindWindowEx")]public static extern int FindWindowEx (int hWnd1,int hWnd2,string lpsz1,string lpsz2);[DllImport("user32.dll", EntryPoint="SendMessage")]public static extern int SendMessage (int hwnd,int wMsg,int wParam,System.Text.StringBuilder lParam);private void button1_Click(object sender, System.EventArgs e){int hwnd = FindWindow("notepad", null);hwnd = FindWindowEx(hwnd, 0, "Edit", null);System.Text.StringBuilder str = new System.Text.StringBuilder(255);SendMessage(hwnd, 0xD, str.Capacity, str);MessageBox.Show(str.ToString());}打开记事本。。随便输入,然后运行以上程序。。 lucbesson(女娃哈哈) :你的方法取记事本就可以取到结果,但是换成QQ,POPO,MSN就不行了.假设我想取POPO正在聊天的聊天记录框里面的值该怎么取? 把int hwnd = FindWindow("notepad", null);里面的"notepad", 换成POPO聊天窗口的标题啊 KentYu(潜水的鱼) :你试试就知道了,不行!钩不住 假如对textbox控件加密了你该怎么办 ?除非你能锁定程序的textbox控件,要不就只能获得键盘信息 !楼主请仔细看好这一句啊,例如qq这样的软件,现在都到什么版本了 ?他们只要对控件加密你就不能准确的应用啦 ! lucbesson(女娃哈哈) 写的不错 winform datagridview dataError 关闭窗口出错 怎样判断另一个窗体已经关闭了?? winform 下log4net只能输出info级别信息,无法输出debug级别的信息 帮忙给一个接口命名,谢谢 知道的指导一下 能不能在listview控件的指定列中添加内容 請高手,指教郵件發送的問題.(分不夠再送) 菜鸟问题:如何把icon对象保存为.ico文件 如何读取照片的拍摄时间? C#中在控制台应用中能完美运行的程序不能在窗体应用程序中完美运行,求解! 谁知道怎样把本地html存入数据库(分数不定,随解决问题给,最高200分) 内存问题---请高手指点迷津阿
应该一样的道理
除非你能锁定程序的textbox控件,要不就只能获得键盘信息 !
参考一下http://dev.csdn.net/develop/article/53/53147.shtm
http://dev.csdn.net/develop/article/41/41301.shtm
参考函数:
那就用Hook了,参考如下的函数:
//装置钩子的函数
[DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]
public static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);//卸下钩子的函数(已用C#语法修改过,可以直接用)
[DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]
public static extern bool UnhookWindowsHookEx(int idHook);[DllImport("user32.dll",CharSet=CharSet.Auto, CallingConvention=CallingConvention.StdCall)]
public static extern int CallNextHookEx(int idHook, int nCode, Int32 wParam, IntPtr lParam); [DllImport("user32")]
public static extern int GetKeyboardState(byte[] pbKeyState);public delegate int HookProc(int nCode, Int32 wParam, IntPtr lParam);
这个应该够参考吧
public static extern int FindWindow (
string lpClassName,
string lpWindowName
);[DllImport("user32.dll", EntryPoint="FindWindowEx")]
public static extern int FindWindowEx (
int hWnd1,
int hWnd2,
string lpsz1,
string lpsz2
);[DllImport("user32.dll", EntryPoint="SendMessage")]
public static extern int SendMessage (
int hwnd,
int wMsg,
int wParam,
System.Text.StringBuilder lParam
);private void button1_Click(object sender, System.EventArgs e)
{
int hwnd = FindWindow("notepad", null);
hwnd = FindWindowEx(hwnd, 0, "Edit", null);
System.Text.StringBuilder str = new System.Text.StringBuilder(255);
SendMessage(hwnd, 0xD, str.Capacity, str);
MessageBox.Show(str.ToString());
}打开记事本。。随便输入,然后运行以上程序。。
除非你能锁定程序的textbox控件,要不就只能获得键盘信息 !
楼主请仔细看好这一句啊,例如qq这样的软件,现在都到什么版本了 ?
他们只要对控件加密你就不能准确的应用啦 !